i18n-keyless-react 1.16.2 → 1.17.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "i18n-keyless-react",
3
3
  "private": false,
4
- "version": "1.16.2",
4
+ "version": "1.17.1",
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.16.2",
20
+ "i18n-keyless-core": "1.17.1",
21
21
  "zustand": "^5.0.3"
22
22
  },
23
23
  "peerDependencies": {
@@ -34,8 +34,9 @@
34
34
  "eslint": "^9.9.0",
35
35
  "eslint-plugin-react-hooks": "^5.1.0-rc.0",
36
36
  "eslint-plugin-react-refresh": "^0.4.9",
37
- "happy-dom": "^17.4.4",
37
+ "happy-dom": "^20.0.11",
38
38
  "jsdom": "^26.0.0",
39
+ "typescript": "^5.9.3",
39
40
  "vitest": "^3.1.1"
40
41
  }
41
42
  }
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
- if (currentLanguage) {
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: useI18nKeyless.getState().config?.languages.initWithDefault });
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.16.2",
4
+ "version": "1.17.1",
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.16.2",
20
+ "i18n-keyless-core": "1.17.1",
21
21
  "zustand": "^5.0.3"
22
22
  },
23
23
  "peerDependencies": {
@@ -34,8 +34,9 @@
34
34
  "eslint": "^9.9.0",
35
35
  "eslint-plugin-react-hooks": "^5.1.0-rc.0",
36
36
  "eslint-plugin-react-refresh": "^0.4.9",
37
- "happy-dom": "^17.4.4",
37
+ "happy-dom": "^20.0.11",
38
38
  "jsdom": "^26.0.0",
39
+ "typescript": "^5.9.3",
39
40
  "vitest": "^3.1.1"
40
41
  }
41
42
  }