@sheet-i18n/react-client 1.5.0-canary.4 → 1.5.0-canary.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +6 -25
- package/dist/index.mjs +6 -25
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -176,7 +176,8 @@ function IntlProvider({
|
|
|
176
176
|
messages: i18nStore == null ? void 0 : i18nStore.localeSet[locale],
|
|
177
177
|
onError: onIntlError,
|
|
178
178
|
children: !isLoading && children
|
|
179
|
-
}
|
|
179
|
+
},
|
|
180
|
+
`sheet-i18n-locale-${locale}`
|
|
180
181
|
);
|
|
181
182
|
}
|
|
182
183
|
function useIntlLocale({
|
|
@@ -227,41 +228,23 @@ var TranslationService = class {
|
|
|
227
228
|
});
|
|
228
229
|
}
|
|
229
230
|
findTargetTranslation(id, $tParams) {
|
|
230
|
-
var _a, _b, _c, _d, _e
|
|
231
|
-
console.log(
|
|
232
|
-
"1) \u2705 intlInstance in findTargetTranslation",
|
|
233
|
-
this == null ? void 0 : this.intlInstance
|
|
234
|
-
);
|
|
231
|
+
var _a, _b, _c, _d, _e;
|
|
235
232
|
const targetTranslation = (_b = (_a = this == null ? void 0 : this.intlInstance) == null ? void 0 : _a.messages) == null ? void 0 : _b[id];
|
|
236
233
|
if (import_shared_utils3.validator.isNullish(targetTranslation)) {
|
|
237
234
|
return id;
|
|
238
235
|
}
|
|
239
|
-
console.log(
|
|
240
|
-
"2) \u2705 targetTranslation in findTargetTranslation",
|
|
241
|
-
targetTranslation
|
|
242
|
-
);
|
|
243
236
|
if (typeof targetTranslation === "string" && targetTranslation.trim() === "") {
|
|
244
237
|
return "";
|
|
245
238
|
}
|
|
246
|
-
console.log("3) \u2705 $tParams in findTargetTranslation", $tParams);
|
|
247
239
|
if (!$tParams || !($tParams == null ? void 0 : $tParams.descriptor)) {
|
|
248
240
|
return "";
|
|
249
241
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
(_d = (_c = this.intlInstance) == null ? void 0 : _c.$t) == null ? void 0 : _d.call(
|
|
253
|
-
_c,
|
|
254
|
-
$tParams.descriptor,
|
|
255
|
-
$tParams.values,
|
|
256
|
-
$tParams.opts
|
|
257
|
-
)
|
|
258
|
-
);
|
|
259
|
-
return (_g = (_f = (_e = this.intlInstance) == null ? void 0 : _e.$t) == null ? void 0 : _f.call(
|
|
260
|
-
_e,
|
|
242
|
+
return (_e = (_d = (_c = this.intlInstance) == null ? void 0 : _c.$t) == null ? void 0 : _d.call(
|
|
243
|
+
_c,
|
|
261
244
|
$tParams.descriptor,
|
|
262
245
|
$tParams.values,
|
|
263
246
|
$tParams.opts
|
|
264
|
-
)) != null ?
|
|
247
|
+
)) != null ? _e : "";
|
|
265
248
|
}
|
|
266
249
|
};
|
|
267
250
|
|
|
@@ -477,13 +460,11 @@ var LISTENER_ID = "LOCALE_STORAGE_LISTENER_ID";
|
|
|
477
460
|
function useLocaleStorage(localeStorageManager) {
|
|
478
461
|
var _a;
|
|
479
462
|
const [locale, setLocale] = (0, import_react3.useState)((_a = localeStorageManager == null ? void 0 : localeStorageManager.getLocale) == null ? void 0 : _a.call(localeStorageManager));
|
|
480
|
-
console.log("\u2705 locale in useLocaleStorage", locale);
|
|
481
463
|
(0, import_react3.useEffect)(() => {
|
|
482
464
|
var _a2;
|
|
483
465
|
(_a2 = localeStorageManager == null ? void 0 : localeStorageManager.observerManager) == null ? void 0 : _a2.addListener({
|
|
484
466
|
listenerId: LISTENER_ID,
|
|
485
467
|
listener: (newLocale) => {
|
|
486
|
-
console.log("\u2705 did you update the locale?", newLocale);
|
|
487
468
|
setLocale(newLocale);
|
|
488
469
|
}
|
|
489
470
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -153,7 +153,8 @@ function IntlProvider({
|
|
|
153
153
|
messages: i18nStore == null ? void 0 : i18nStore.localeSet[locale],
|
|
154
154
|
onError: onIntlError,
|
|
155
155
|
children: !isLoading && children
|
|
156
|
-
}
|
|
156
|
+
},
|
|
157
|
+
`sheet-i18n-locale-${locale}`
|
|
157
158
|
);
|
|
158
159
|
}
|
|
159
160
|
function useIntlLocale({
|
|
@@ -204,41 +205,23 @@ var TranslationService = class {
|
|
|
204
205
|
});
|
|
205
206
|
}
|
|
206
207
|
findTargetTranslation(id, $tParams) {
|
|
207
|
-
var _a, _b, _c, _d, _e
|
|
208
|
-
console.log(
|
|
209
|
-
"1) \u2705 intlInstance in findTargetTranslation",
|
|
210
|
-
this == null ? void 0 : this.intlInstance
|
|
211
|
-
);
|
|
208
|
+
var _a, _b, _c, _d, _e;
|
|
212
209
|
const targetTranslation = (_b = (_a = this == null ? void 0 : this.intlInstance) == null ? void 0 : _a.messages) == null ? void 0 : _b[id];
|
|
213
210
|
if (validator3.isNullish(targetTranslation)) {
|
|
214
211
|
return id;
|
|
215
212
|
}
|
|
216
|
-
console.log(
|
|
217
|
-
"2) \u2705 targetTranslation in findTargetTranslation",
|
|
218
|
-
targetTranslation
|
|
219
|
-
);
|
|
220
213
|
if (typeof targetTranslation === "string" && targetTranslation.trim() === "") {
|
|
221
214
|
return "";
|
|
222
215
|
}
|
|
223
|
-
console.log("3) \u2705 $tParams in findTargetTranslation", $tParams);
|
|
224
216
|
if (!$tParams || !($tParams == null ? void 0 : $tParams.descriptor)) {
|
|
225
217
|
return "";
|
|
226
218
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
(_d = (_c = this.intlInstance) == null ? void 0 : _c.$t) == null ? void 0 : _d.call(
|
|
230
|
-
_c,
|
|
231
|
-
$tParams.descriptor,
|
|
232
|
-
$tParams.values,
|
|
233
|
-
$tParams.opts
|
|
234
|
-
)
|
|
235
|
-
);
|
|
236
|
-
return (_g = (_f = (_e = this.intlInstance) == null ? void 0 : _e.$t) == null ? void 0 : _f.call(
|
|
237
|
-
_e,
|
|
219
|
+
return (_e = (_d = (_c = this.intlInstance) == null ? void 0 : _c.$t) == null ? void 0 : _d.call(
|
|
220
|
+
_c,
|
|
238
221
|
$tParams.descriptor,
|
|
239
222
|
$tParams.values,
|
|
240
223
|
$tParams.opts
|
|
241
|
-
)) != null ?
|
|
224
|
+
)) != null ? _e : "";
|
|
242
225
|
}
|
|
243
226
|
};
|
|
244
227
|
|
|
@@ -454,13 +437,11 @@ var LISTENER_ID = "LOCALE_STORAGE_LISTENER_ID";
|
|
|
454
437
|
function useLocaleStorage(localeStorageManager) {
|
|
455
438
|
var _a;
|
|
456
439
|
const [locale, setLocale] = useState2((_a = localeStorageManager == null ? void 0 : localeStorageManager.getLocale) == null ? void 0 : _a.call(localeStorageManager));
|
|
457
|
-
console.log("\u2705 locale in useLocaleStorage", locale);
|
|
458
440
|
useEffect2(() => {
|
|
459
441
|
var _a2;
|
|
460
442
|
(_a2 = localeStorageManager == null ? void 0 : localeStorageManager.observerManager) == null ? void 0 : _a2.addListener({
|
|
461
443
|
listenerId: LISTENER_ID,
|
|
462
444
|
listener: (newLocale) => {
|
|
463
|
-
console.log("\u2705 did you update the locale?", newLocale);
|
|
464
445
|
setLocale(newLocale);
|
|
465
446
|
}
|
|
466
447
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sheet-i18n/react-client",
|
|
3
|
-
"version": "1.5.0-canary.
|
|
3
|
+
"version": "1.5.0-canary.6",
|
|
4
4
|
"description": "a client package for react modules used by sheet-i18n",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
},
|
|
26
26
|
"license": "ISC",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@sheet-i18n/shared-utils": "1.8.0-canary.0",
|
|
29
28
|
"@sheet-i18n/errors": "1.8.0-canary.0",
|
|
29
|
+
"@sheet-i18n/shared-utils": "1.8.0-canary.0",
|
|
30
30
|
"@sheet-i18n/react-core": "1.5.0-canary.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|