@sheet-i18n/react-client 1.5.0-canary.1 → 1.5.0-canary.10
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -7
- package/dist/index.mjs +10 -7
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
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({
|
|
@@ -418,11 +419,10 @@ var LocaleStorageManager = class {
|
|
|
418
419
|
this.observerManager = new import_shared_utils4.ObserverManager();
|
|
419
420
|
this.initializeCurrentLocale = () => {
|
|
420
421
|
var _a, _b;
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
);
|
|
422
|
+
const storedLocale = this.storageService.getItem(this.localeStorageKey);
|
|
423
|
+
if (!storedLocale || storedLocale === "") {
|
|
424
|
+
const defaultLocale = this.i18nStore.currentLocale || this.i18nStore.defaultLocale;
|
|
425
|
+
this.storageService.setItem(this.localeStorageKey, defaultLocale);
|
|
426
426
|
}
|
|
427
427
|
(_b = (_a = this.i18nStore) == null ? void 0 : _a.observerManager) == null ? void 0 : _b.addListener({
|
|
428
428
|
listenerId: this.localeStorageKey,
|
|
@@ -433,7 +433,10 @@ var LocaleStorageManager = class {
|
|
|
433
433
|
};
|
|
434
434
|
this.getLocale = () => {
|
|
435
435
|
const stored = this.storageService.getItem(this.localeStorageKey);
|
|
436
|
-
|
|
436
|
+
if (!stored || stored === "") {
|
|
437
|
+
return this.i18nStore.defaultLocale;
|
|
438
|
+
}
|
|
439
|
+
return stored;
|
|
437
440
|
};
|
|
438
441
|
this.setLocale = (locale) => {
|
|
439
442
|
this.storageService.setItem(this.localeStorageKey, locale);
|
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({
|
|
@@ -395,11 +396,10 @@ var LocaleStorageManager = class {
|
|
|
395
396
|
this.observerManager = new ObserverManager();
|
|
396
397
|
this.initializeCurrentLocale = () => {
|
|
397
398
|
var _a, _b;
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
);
|
|
399
|
+
const storedLocale = this.storageService.getItem(this.localeStorageKey);
|
|
400
|
+
if (!storedLocale || storedLocale === "") {
|
|
401
|
+
const defaultLocale = this.i18nStore.currentLocale || this.i18nStore.defaultLocale;
|
|
402
|
+
this.storageService.setItem(this.localeStorageKey, defaultLocale);
|
|
403
403
|
}
|
|
404
404
|
(_b = (_a = this.i18nStore) == null ? void 0 : _a.observerManager) == null ? void 0 : _b.addListener({
|
|
405
405
|
listenerId: this.localeStorageKey,
|
|
@@ -410,7 +410,10 @@ var LocaleStorageManager = class {
|
|
|
410
410
|
};
|
|
411
411
|
this.getLocale = () => {
|
|
412
412
|
const stored = this.storageService.getItem(this.localeStorageKey);
|
|
413
|
-
|
|
413
|
+
if (!stored || stored === "") {
|
|
414
|
+
return this.i18nStore.defaultLocale;
|
|
415
|
+
}
|
|
416
|
+
return stored;
|
|
414
417
|
};
|
|
415
418
|
this.setLocale = (locale) => {
|
|
416
419
|
this.storageService.setItem(this.localeStorageKey, locale);
|
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.10",
|
|
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,16 +25,16 @@
|
|
|
25
25
|
},
|
|
26
26
|
"license": "ISC",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@sheet-i18n/shared-utils": "1.8.0-canary.
|
|
29
|
-
"@sheet-i18n/
|
|
30
|
-
"@sheet-i18n/
|
|
28
|
+
"@sheet-i18n/shared-utils": "1.8.0-canary.4",
|
|
29
|
+
"@sheet-i18n/react-core": "1.5.0-canary.4",
|
|
30
|
+
"@sheet-i18n/errors": "1.8.0-canary.4"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/react": "^19.0.2",
|
|
34
34
|
"@types/react-dom": "^19.0.2",
|
|
35
35
|
"react": "^18.2.0",
|
|
36
36
|
"react-intl": "^7.0.4",
|
|
37
|
-
"@sheet-i18n/typescript-config": "1.8.0-canary.
|
|
37
|
+
"@sheet-i18n/typescript-config": "1.8.0-canary.4"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"react": "^18 || ^19 || ^20 || ^21",
|