@modern-js/plugin-i18n 3.11.3 → 3.12.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/CHANGELOG.md +15 -0
- package/dist/cjs/runtime/i18n/detection/index.js +4 -4
- package/dist/cjs/runtime/i18n/detection/middleware.js +2 -2
- package/dist/cjs/runtime/i18n/detection/middleware.node.js +1 -1
- package/dist/cjs/runtime/i18n/instance.js +2 -2
- package/dist/cjs/runtime/i18n/react-i18next.js +2 -2
- package/dist/cjs/runtime/utils.js +1 -1
- package/dist/cjs/shared/detection.js +1 -1
- package/dist/esm/runtime/i18n/detection/index.mjs +4 -4
- package/dist/esm/runtime/i18n/detection/middleware.mjs +2 -2
- package/dist/esm/runtime/i18n/detection/middleware.node.mjs +1 -1
- package/dist/esm/runtime/i18n/instance.mjs +2 -2
- package/dist/esm/runtime/i18n/react-i18next.mjs +2 -2
- package/dist/esm/runtime/utils.mjs +1 -1
- package/dist/esm/shared/detection.mjs +1 -1
- package/dist/esm-node/runtime/i18n/detection/index.mjs +4 -4
- package/dist/esm-node/runtime/i18n/detection/middleware.mjs +2 -2
- package/dist/esm-node/runtime/i18n/detection/middleware.node.mjs +1 -1
- package/dist/esm-node/runtime/i18n/instance.mjs +2 -2
- package/dist/esm-node/runtime/i18n/react-i18next.mjs +2 -2
- package/dist/esm-node/runtime/utils.mjs +1 -1
- package/dist/esm-node/shared/detection.mjs +1 -1
- package/package.json +13 -13
- package/src/runtime/i18n/detection/index.ts +4 -4
- package/src/runtime/i18n/detection/middleware.node.ts +1 -1
- package/src/runtime/i18n/detection/middleware.ts +2 -2
- package/src/runtime/i18n/instance.ts +2 -2
- package/src/runtime/i18n/react-i18next.ts +2 -2
- package/src/runtime/utils.ts +1 -1
- package/src/shared/detection.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @modern-js/plugin-i18n
|
|
2
2
|
|
|
3
|
+
## 3.12.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [b35f295]
|
|
8
|
+
- Updated dependencies [67fc367]
|
|
9
|
+
- Updated dependencies [d378801]
|
|
10
|
+
- Updated dependencies [8bb2f02]
|
|
11
|
+
- @modern-js/utils@3.12.0
|
|
12
|
+
- @modern-js/types@3.12.0
|
|
13
|
+
- @modern-js/server-core@3.12.0
|
|
14
|
+
- @modern-js/plugin@3.12.0
|
|
15
|
+
- @modern-js/runtime-utils@3.12.0
|
|
16
|
+
- @modern-js/server-runtime@3.12.0
|
|
17
|
+
|
|
3
18
|
## 3.11.3
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -114,7 +114,7 @@ const getLanguageFromSSRData = (window1)=>{
|
|
|
114
114
|
if (!ssrData || !ssrData.data || !ssrData.data.i18nData) return;
|
|
115
115
|
const lng = ssrData.data.i18nData.lng;
|
|
116
116
|
return 'string' == typeof lng && '' !== lng.trim() ? lng : void 0;
|
|
117
|
-
} catch
|
|
117
|
+
} catch {
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
120
|
};
|
|
@@ -143,7 +143,7 @@ const detectLanguageFromSSR = (languages)=>{
|
|
|
143
143
|
try {
|
|
144
144
|
const ssrLanguage = getLanguageFromSSRData(window);
|
|
145
145
|
if (ssrLanguage && isLanguageSupported(ssrLanguage, languages)) return ssrLanguage;
|
|
146
|
-
} catch
|
|
146
|
+
} catch {}
|
|
147
147
|
};
|
|
148
148
|
const detectLanguageFromPathPriority = (pathname, languages, localePathRedirect)=>{
|
|
149
149
|
if (!localePathRedirect) return;
|
|
@@ -152,7 +152,7 @@ const detectLanguageFromPathPriority = (pathname, languages, localePathRedirect)
|
|
|
152
152
|
try {
|
|
153
153
|
const pathDetection = (0, external_utils_js_namespaceObject.detectLanguageFromPath)(pathname, languages, localePathRedirect);
|
|
154
154
|
if (true === pathDetection.detected && pathDetection.language) return pathDetection.language;
|
|
155
|
-
} catch
|
|
155
|
+
} catch {}
|
|
156
156
|
};
|
|
157
157
|
const createDetectorInstance = (baseInstance, configKey)=>{
|
|
158
158
|
const cached = detectorInstanceCache.get(baseInstance);
|
|
@@ -236,7 +236,7 @@ const detectLanguageFromI18nextDetector = async (i18nInstance, options)=>{
|
|
|
236
236
|
const currentLang = detectorInstance.language;
|
|
237
237
|
if (isLanguageSupported(currentLang, options.languages)) return currentLang;
|
|
238
238
|
}
|
|
239
|
-
} catch
|
|
239
|
+
} catch {} finally{
|
|
240
240
|
if (isTemporary && detectorInstance !== i18nInstance) detectorInstanceCache.set(i18nInstance, {
|
|
241
241
|
instance: detectorInstance,
|
|
242
242
|
isTemporary: true,
|
|
@@ -111,7 +111,7 @@ const readLanguageFromStorage = (detectionOptions, _request, _languages)=>{
|
|
|
111
111
|
break;
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
} catch
|
|
114
|
+
} catch {}
|
|
115
115
|
};
|
|
116
116
|
const detectLanguage = (i18nInstance, _request, detectionOptions)=>{
|
|
117
117
|
try {
|
|
@@ -142,7 +142,7 @@ const detectLanguage = (i18nInstance, _request, detectionOptions)=>{
|
|
|
142
142
|
if (Array.isArray(result) && result.length > 0) return result[0];
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
} catch
|
|
145
|
+
} catch {}
|
|
146
146
|
};
|
|
147
147
|
const cacheUserLanguage = (i18nInstance, language, detectionOptions)=>{
|
|
148
148
|
if ("u" < typeof window) return;
|
|
@@ -66,7 +66,7 @@ const detectLanguage = (i18nInstance, request, detectionOptions)=>{
|
|
|
66
66
|
if ('string' == typeof result) return result;
|
|
67
67
|
if (Array.isArray(result) && result.length > 0) return result[0];
|
|
68
68
|
}
|
|
69
|
-
} catch
|
|
69
|
+
} catch {}
|
|
70
70
|
};
|
|
71
71
|
exports.cacheUserLanguage = __webpack_exports__.cacheUserLanguage;
|
|
72
72
|
exports.detectLanguage = __webpack_exports__.detectLanguage;
|
|
@@ -54,7 +54,7 @@ async function tryImportI18next() {
|
|
|
54
54
|
try {
|
|
55
55
|
const i18next = await import("i18next");
|
|
56
56
|
return i18next.default;
|
|
57
|
-
} catch
|
|
57
|
+
} catch {
|
|
58
58
|
return null;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -65,7 +65,7 @@ async function createI18nextInstance() {
|
|
|
65
65
|
return i18next.createInstance?.({
|
|
66
66
|
initImmediate: false
|
|
67
67
|
});
|
|
68
|
-
} catch
|
|
68
|
+
} catch {
|
|
69
69
|
return null;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -31,7 +31,7 @@ async function getInitReactI18next() {
|
|
|
31
31
|
try {
|
|
32
32
|
const { initReactI18next } = await import("react-i18next");
|
|
33
33
|
return initReactI18next;
|
|
34
|
-
} catch
|
|
34
|
+
} catch {
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -39,7 +39,7 @@ async function getI18nextProvider() {
|
|
|
39
39
|
try {
|
|
40
40
|
const { I18nextProvider } = await import("react-i18next");
|
|
41
41
|
return I18nextProvider;
|
|
42
|
-
} catch
|
|
42
|
+
} catch {
|
|
43
43
|
return null;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -111,7 +111,7 @@ function detectLanguageFromRequest(req, languages, detectionOptions) {
|
|
|
111
111
|
if (languages.includes(baseLang)) return baseLang;
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
} catch
|
|
114
|
+
} catch {}
|
|
115
115
|
return null;
|
|
116
116
|
}
|
|
117
117
|
exports.detectLanguageFromRequest = __webpack_exports__.detectLanguageFromRequest;
|
|
@@ -77,7 +77,7 @@ const getLanguageFromSSRData = (window1)=>{
|
|
|
77
77
|
if (!ssrData || !ssrData.data || !ssrData.data.i18nData) return;
|
|
78
78
|
const lng = ssrData.data.i18nData.lng;
|
|
79
79
|
return 'string' == typeof lng && '' !== lng.trim() ? lng : void 0;
|
|
80
|
-
} catch
|
|
80
|
+
} catch {
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
83
|
};
|
|
@@ -106,7 +106,7 @@ const detectLanguageFromSSR = (languages)=>{
|
|
|
106
106
|
try {
|
|
107
107
|
const ssrLanguage = getLanguageFromSSRData(window);
|
|
108
108
|
if (ssrLanguage && isLanguageSupported(ssrLanguage, languages)) return ssrLanguage;
|
|
109
|
-
} catch
|
|
109
|
+
} catch {}
|
|
110
110
|
};
|
|
111
111
|
const detectLanguageFromPathPriority = (pathname, languages, localePathRedirect)=>{
|
|
112
112
|
if (!localePathRedirect) return;
|
|
@@ -115,7 +115,7 @@ const detectLanguageFromPathPriority = (pathname, languages, localePathRedirect)
|
|
|
115
115
|
try {
|
|
116
116
|
const pathDetection = detectLanguageFromPath(pathname, languages, localePathRedirect);
|
|
117
117
|
if (true === pathDetection.detected && pathDetection.language) return pathDetection.language;
|
|
118
|
-
} catch
|
|
118
|
+
} catch {}
|
|
119
119
|
};
|
|
120
120
|
const createDetectorInstance = (baseInstance, configKey)=>{
|
|
121
121
|
const cached = detectorInstanceCache.get(baseInstance);
|
|
@@ -199,7 +199,7 @@ const detectLanguageFromI18nextDetector = async (i18nInstance, options)=>{
|
|
|
199
199
|
const currentLang = detectorInstance.language;
|
|
200
200
|
if (isLanguageSupported(currentLang, options.languages)) return currentLang;
|
|
201
201
|
}
|
|
202
|
-
} catch
|
|
202
|
+
} catch {} finally{
|
|
203
203
|
if (isTemporary && detectorInstance !== i18nInstance) detectorInstanceCache.set(i18nInstance, {
|
|
204
204
|
instance: detectorInstance,
|
|
205
205
|
isTemporary: true,
|
|
@@ -66,7 +66,7 @@ const readLanguageFromStorage = (detectionOptions, _request, _languages)=>{
|
|
|
66
66
|
break;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
} catch
|
|
69
|
+
} catch {}
|
|
70
70
|
};
|
|
71
71
|
const detectLanguage = (i18nInstance, _request, detectionOptions)=>{
|
|
72
72
|
try {
|
|
@@ -97,7 +97,7 @@ const detectLanguage = (i18nInstance, _request, detectionOptions)=>{
|
|
|
97
97
|
if (Array.isArray(result) && result.length > 0) return result[0];
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
} catch
|
|
100
|
+
} catch {}
|
|
101
101
|
};
|
|
102
102
|
const cacheUserLanguage = (i18nInstance, language, detectionOptions)=>{
|
|
103
103
|
if ("u" < typeof window) return;
|
|
@@ -31,6 +31,6 @@ const detectLanguage = (i18nInstance, request, detectionOptions)=>{
|
|
|
31
31
|
if ('string' == typeof result) return result;
|
|
32
32
|
if (Array.isArray(result) && result.length > 0) return result[0];
|
|
33
33
|
}
|
|
34
|
-
} catch
|
|
34
|
+
} catch {}
|
|
35
35
|
};
|
|
36
36
|
export { cacheUserLanguage, detectLanguage, readLanguageFromStorage, useI18nextLanguageDetector };
|
|
@@ -25,7 +25,7 @@ async function tryImportI18next() {
|
|
|
25
25
|
try {
|
|
26
26
|
const i18next = await import("i18next");
|
|
27
27
|
return i18next.default;
|
|
28
|
-
} catch
|
|
28
|
+
} catch {
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -36,7 +36,7 @@ async function createI18nextInstance() {
|
|
|
36
36
|
return i18next.createInstance?.({
|
|
37
37
|
initImmediate: false
|
|
38
38
|
});
|
|
39
|
-
} catch
|
|
39
|
+
} catch {
|
|
40
40
|
return null;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -2,7 +2,7 @@ async function getInitReactI18next() {
|
|
|
2
2
|
try {
|
|
3
3
|
const { initReactI18next } = await import("react-i18next");
|
|
4
4
|
return initReactI18next;
|
|
5
|
-
} catch
|
|
5
|
+
} catch {
|
|
6
6
|
return null;
|
|
7
7
|
}
|
|
8
8
|
}
|
|
@@ -10,7 +10,7 @@ async function getI18nextProvider() {
|
|
|
10
10
|
try {
|
|
11
11
|
const { I18nextProvider } = await import("react-i18next");
|
|
12
12
|
return I18nextProvider;
|
|
13
|
-
} catch
|
|
13
|
+
} catch {
|
|
14
14
|
return null;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -78,7 +78,7 @@ const getLanguageFromSSRData = (window1)=>{
|
|
|
78
78
|
if (!ssrData || !ssrData.data || !ssrData.data.i18nData) return;
|
|
79
79
|
const lng = ssrData.data.i18nData.lng;
|
|
80
80
|
return 'string' == typeof lng && '' !== lng.trim() ? lng : void 0;
|
|
81
|
-
} catch
|
|
81
|
+
} catch {
|
|
82
82
|
return;
|
|
83
83
|
}
|
|
84
84
|
};
|
|
@@ -107,7 +107,7 @@ const detectLanguageFromSSR = (languages)=>{
|
|
|
107
107
|
try {
|
|
108
108
|
const ssrLanguage = getLanguageFromSSRData(window);
|
|
109
109
|
if (ssrLanguage && isLanguageSupported(ssrLanguage, languages)) return ssrLanguage;
|
|
110
|
-
} catch
|
|
110
|
+
} catch {}
|
|
111
111
|
};
|
|
112
112
|
const detectLanguageFromPathPriority = (pathname, languages, localePathRedirect)=>{
|
|
113
113
|
if (!localePathRedirect) return;
|
|
@@ -116,7 +116,7 @@ const detectLanguageFromPathPriority = (pathname, languages, localePathRedirect)
|
|
|
116
116
|
try {
|
|
117
117
|
const pathDetection = detectLanguageFromPath(pathname, languages, localePathRedirect);
|
|
118
118
|
if (true === pathDetection.detected && pathDetection.language) return pathDetection.language;
|
|
119
|
-
} catch
|
|
119
|
+
} catch {}
|
|
120
120
|
};
|
|
121
121
|
const createDetectorInstance = (baseInstance, configKey)=>{
|
|
122
122
|
const cached = detectorInstanceCache.get(baseInstance);
|
|
@@ -200,7 +200,7 @@ const detectLanguageFromI18nextDetector = async (i18nInstance, options)=>{
|
|
|
200
200
|
const currentLang = detectorInstance.language;
|
|
201
201
|
if (isLanguageSupported(currentLang, options.languages)) return currentLang;
|
|
202
202
|
}
|
|
203
|
-
} catch
|
|
203
|
+
} catch {} finally{
|
|
204
204
|
if (isTemporary && detectorInstance !== i18nInstance) detectorInstanceCache.set(i18nInstance, {
|
|
205
205
|
instance: detectorInstance,
|
|
206
206
|
isTemporary: true,
|
|
@@ -67,7 +67,7 @@ const readLanguageFromStorage = (detectionOptions, _request, _languages)=>{
|
|
|
67
67
|
break;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
} catch
|
|
70
|
+
} catch {}
|
|
71
71
|
};
|
|
72
72
|
const detectLanguage = (i18nInstance, _request, detectionOptions)=>{
|
|
73
73
|
try {
|
|
@@ -98,7 +98,7 @@ const detectLanguage = (i18nInstance, _request, detectionOptions)=>{
|
|
|
98
98
|
if (Array.isArray(result) && result.length > 0) return result[0];
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
} catch
|
|
101
|
+
} catch {}
|
|
102
102
|
};
|
|
103
103
|
const cacheUserLanguage = (i18nInstance, language, detectionOptions)=>{
|
|
104
104
|
if ("u" < typeof window) return;
|
|
@@ -32,6 +32,6 @@ const detectLanguage = (i18nInstance, request, detectionOptions)=>{
|
|
|
32
32
|
if ('string' == typeof result) return result;
|
|
33
33
|
if (Array.isArray(result) && result.length > 0) return result[0];
|
|
34
34
|
}
|
|
35
|
-
} catch
|
|
35
|
+
} catch {}
|
|
36
36
|
};
|
|
37
37
|
export { cacheUserLanguage, detectLanguage, readLanguageFromStorage, useI18nextLanguageDetector };
|
|
@@ -26,7 +26,7 @@ async function tryImportI18next() {
|
|
|
26
26
|
try {
|
|
27
27
|
const i18next = await import("i18next");
|
|
28
28
|
return i18next.default;
|
|
29
|
-
} catch
|
|
29
|
+
} catch {
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -37,7 +37,7 @@ async function createI18nextInstance() {
|
|
|
37
37
|
return i18next.createInstance?.({
|
|
38
38
|
initImmediate: false
|
|
39
39
|
});
|
|
40
|
-
} catch
|
|
40
|
+
} catch {
|
|
41
41
|
return null;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -3,7 +3,7 @@ async function getInitReactI18next() {
|
|
|
3
3
|
try {
|
|
4
4
|
const { initReactI18next } = await import("react-i18next");
|
|
5
5
|
return initReactI18next;
|
|
6
|
-
} catch
|
|
6
|
+
} catch {
|
|
7
7
|
return null;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -11,7 +11,7 @@ async function getI18nextProvider() {
|
|
|
11
11
|
try {
|
|
12
12
|
const { I18nextProvider } = await import("react-i18next");
|
|
13
13
|
return I18nextProvider;
|
|
14
|
-
} catch
|
|
14
|
+
} catch {
|
|
15
15
|
return null;
|
|
16
16
|
}
|
|
17
17
|
}
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "3.
|
|
18
|
+
"version": "3.12.0",
|
|
19
19
|
"engines": {
|
|
20
20
|
"node": ">=20"
|
|
21
21
|
},
|
|
@@ -82,22 +82,22 @@
|
|
|
82
82
|
"@swc/helpers": "^0.5.17",
|
|
83
83
|
"i18next-browser-languagedetector": "^8.3.0",
|
|
84
84
|
"i18next-chained-backend": "^4.6.3",
|
|
85
|
-
"i18next-fs-backend": "^2.6.
|
|
86
|
-
"i18next-http-backend": "^4.0.
|
|
85
|
+
"i18next-fs-backend": "^2.6.12",
|
|
86
|
+
"i18next-http-backend": "^4.0.10",
|
|
87
87
|
"i18next-http-middleware": "^3.10.0",
|
|
88
|
-
"@modern-js/plugin": "3.
|
|
89
|
-
"@modern-js/runtime
|
|
90
|
-
"@modern-js/
|
|
91
|
-
"@modern-js/server-
|
|
92
|
-
"@modern-js/types": "3.
|
|
93
|
-
"@modern-js/utils": "3.
|
|
88
|
+
"@modern-js/plugin": "3.12.0",
|
|
89
|
+
"@modern-js/server-runtime": "3.12.0",
|
|
90
|
+
"@modern-js/runtime-utils": "3.12.0",
|
|
91
|
+
"@modern-js/server-core": "3.12.0",
|
|
92
|
+
"@modern-js/types": "3.12.0",
|
|
93
|
+
"@modern-js/utils": "3.12.0"
|
|
94
94
|
},
|
|
95
95
|
"peerDependencies": {
|
|
96
96
|
"react": ">=18.3.1",
|
|
97
97
|
"react-dom": ">=18.3.1",
|
|
98
98
|
"i18next": ">=25.10.10",
|
|
99
99
|
"react-i18next": ">=15.7.4",
|
|
100
|
-
"@modern-js/runtime": "^3.
|
|
100
|
+
"@modern-js/runtime": "^3.12.0"
|
|
101
101
|
},
|
|
102
102
|
"peerDependenciesMeta": {
|
|
103
103
|
"i18next": {
|
|
@@ -115,9 +115,9 @@
|
|
|
115
115
|
"react-i18next": "15.7.4",
|
|
116
116
|
"ts-node": "^10.9.2",
|
|
117
117
|
"typescript": "^5",
|
|
118
|
-
"@modern-js/app-tools": "3.
|
|
119
|
-
"@modern-js/rslib": "3.
|
|
120
|
-
"@modern-js/runtime": "3.
|
|
118
|
+
"@modern-js/app-tools": "3.12.0",
|
|
119
|
+
"@modern-js/rslib": "3.12.0",
|
|
120
|
+
"@modern-js/runtime": "3.12.0"
|
|
121
121
|
},
|
|
122
122
|
"sideEffects": false,
|
|
123
123
|
"publishConfig": {
|
|
@@ -144,7 +144,7 @@ export const getLanguageFromSSRData = (window: Window): string | undefined => {
|
|
|
144
144
|
const lng = ssrData.data.i18nData.lng;
|
|
145
145
|
// Return language only if it's a non-empty string
|
|
146
146
|
return typeof lng === 'string' && lng.trim() !== '' ? lng : undefined;
|
|
147
|
-
} catch
|
|
147
|
+
} catch {
|
|
148
148
|
// If accessing window._SSR_DATA throws an error, return undefined
|
|
149
149
|
return undefined;
|
|
150
150
|
}
|
|
@@ -250,7 +250,7 @@ const detectLanguageFromSSR = (languages: string[]): string | undefined => {
|
|
|
250
250
|
if (ssrLanguage && isLanguageSupported(ssrLanguage, languages)) {
|
|
251
251
|
return ssrLanguage;
|
|
252
252
|
}
|
|
253
|
-
} catch
|
|
253
|
+
} catch {
|
|
254
254
|
// Silently ignore errors
|
|
255
255
|
}
|
|
256
256
|
|
|
@@ -290,7 +290,7 @@ const detectLanguageFromPathPriority = (
|
|
|
290
290
|
if (pathDetection.detected === true && pathDetection.language) {
|
|
291
291
|
return pathDetection.language;
|
|
292
292
|
}
|
|
293
|
-
} catch
|
|
293
|
+
} catch {
|
|
294
294
|
// Silently ignore errors, return undefined
|
|
295
295
|
}
|
|
296
296
|
|
|
@@ -466,7 +466,7 @@ const detectLanguageFromI18nextDetector = async (
|
|
|
466
466
|
return currentLang;
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
|
-
} catch
|
|
469
|
+
} catch {
|
|
470
470
|
// Silently ignore errors
|
|
471
471
|
} finally {
|
|
472
472
|
// Clean up temporary instance to avoid affecting subsequent formal initialization
|
|
@@ -101,7 +101,7 @@ export const readLanguageFromStorage = (
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
} catch
|
|
104
|
+
} catch {
|
|
105
105
|
// Ignore errors
|
|
106
106
|
}
|
|
107
107
|
|
|
@@ -174,7 +174,7 @@ export const detectLanguage = (
|
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
-
} catch
|
|
177
|
+
} catch {
|
|
178
178
|
return undefined;
|
|
179
179
|
}
|
|
180
180
|
|
|
@@ -148,7 +148,7 @@ async function tryImportI18next(): Promise<I18nInstance | null> {
|
|
|
148
148
|
try {
|
|
149
149
|
const i18next = await import('i18next');
|
|
150
150
|
return i18next.default as unknown as I18nInstance;
|
|
151
|
-
} catch
|
|
151
|
+
} catch {
|
|
152
152
|
return null;
|
|
153
153
|
}
|
|
154
154
|
}
|
|
@@ -162,7 +162,7 @@ async function createI18nextInstance(): Promise<I18nInstance | null> {
|
|
|
162
162
|
return i18next.createInstance?.({
|
|
163
163
|
initImmediate: false,
|
|
164
164
|
}) as unknown as I18nInstance;
|
|
165
|
-
} catch
|
|
165
|
+
} catch {
|
|
166
166
|
return null;
|
|
167
167
|
}
|
|
168
168
|
}
|
|
@@ -5,7 +5,7 @@ export async function getInitReactI18next() {
|
|
|
5
5
|
try {
|
|
6
6
|
const { initReactI18next } = await import('react-i18next');
|
|
7
7
|
return initReactI18next;
|
|
8
|
-
} catch
|
|
8
|
+
} catch {
|
|
9
9
|
return null;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
@@ -14,7 +14,7 @@ export async function getI18nextProvider() {
|
|
|
14
14
|
try {
|
|
15
15
|
const { I18nextProvider } = await import('react-i18next');
|
|
16
16
|
return I18nextProvider;
|
|
17
|
-
} catch
|
|
17
|
+
} catch {
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
20
|
}
|
package/src/runtime/utils.ts
CHANGED