i18n-keyless-react 1.16.2 → 1.17.0
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/package.json +2 -2
- package/dist/store.js +8 -2
- package/dist/types.d.ts +1 -0
- package/package.json +2 -2
package/dist/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "i18n-keyless-react",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.17.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"postpublish": "rm -rf ./dist && rm *.tgz"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"i18n-keyless-core": "1.
|
|
20
|
+
"i18n-keyless-core": "1.17.0",
|
|
21
21
|
"zustand": "^5.0.3"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
package/dist/store.js
CHANGED
|
@@ -142,7 +142,13 @@ async function hydrate() {
|
|
|
142
142
|
console.log("i18n-keyless: _hydrate: no translations usage");
|
|
143
143
|
}
|
|
144
144
|
const currentLanguage = await getItem(storeKeys.currentLanguage, storage);
|
|
145
|
-
|
|
145
|
+
const skipCurrentLanguageHydration = config.languages.skipCurrentLanguageHydration;
|
|
146
|
+
if (skipCurrentLanguageHydration) {
|
|
147
|
+
if (debug)
|
|
148
|
+
console.log("i18n-keyless: _hydrate: skip current language hydration");
|
|
149
|
+
useI18nKeyless.setState({ currentLanguage: config?.languages.initWithDefault });
|
|
150
|
+
}
|
|
151
|
+
else if (currentLanguage) {
|
|
146
152
|
if (debug)
|
|
147
153
|
console.log("i18n-keyless: _hydrate", currentLanguage);
|
|
148
154
|
useI18nKeyless.setState({ currentLanguage: currentLanguage });
|
|
@@ -150,7 +156,7 @@ async function hydrate() {
|
|
|
150
156
|
else {
|
|
151
157
|
if (debug)
|
|
152
158
|
console.log("i18n-keyless: _hydrate: no current language");
|
|
153
|
-
useI18nKeyless.setState({ currentLanguage:
|
|
159
|
+
useI18nKeyless.setState({ currentLanguage: config?.languages.initWithDefault });
|
|
154
160
|
}
|
|
155
161
|
const uniqueId = await getItem(storeKeys.uniqueId, storage);
|
|
156
162
|
if (uniqueId) {
|
package/dist/types.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export interface I18nConfig {
|
|
|
25
25
|
* supported: the languages supported for the user
|
|
26
26
|
* fallback: if the user's langauge is not supported, the fallback language will be used
|
|
27
27
|
* initWithDefault: the language to use when the app is initialized for the first time
|
|
28
|
+
* skipCurrentLanguageHydration: if true, the current language will not be hydrated from the storage, and the app will use the initWithDefault language
|
|
28
29
|
*/
|
|
29
30
|
languages: LanguagesConfig;
|
|
30
31
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "i18n-keyless-react",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.17.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"postpublish": "rm -rf ./dist && rm *.tgz"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"i18n-keyless-core": "1.
|
|
20
|
+
"i18n-keyless-core": "1.17.0",
|
|
21
21
|
"zustand": "^5.0.3"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|