@bleedingdev/modern-js-plugin-i18n 3.2.0-ultramodern.2 → 3.2.0-ultramodern.23
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/cjs/cli/index.js +22 -0
- package/dist/cjs/runtime/I18nLink.js +4 -12
- package/dist/cjs/runtime/context.js +32 -5
- package/dist/cjs/runtime/hooks.js +8 -5
- package/dist/cjs/runtime/i18n/backend/defaults.js +1 -1
- package/dist/cjs/runtime/i18n/backend/middleware.node.js +4 -4
- package/dist/cjs/runtime/i18n/instance.js +4 -2
- package/dist/cjs/runtime/index.js +7 -6
- package/dist/cjs/runtime/routerAdapter.js +163 -0
- package/dist/cjs/runtime/utils.js +63 -94
- package/dist/cjs/server/index.js +64 -8
- package/dist/cjs/shared/localisedUrls.js +237 -0
- package/dist/esm/cli/index.mjs +22 -0
- package/dist/esm/runtime/I18nLink.mjs +4 -12
- package/dist/esm/runtime/context.mjs +34 -7
- package/dist/esm/runtime/hooks.mjs +9 -6
- package/dist/esm/runtime/i18n/backend/defaults.mjs +1 -1
- package/dist/esm/runtime/i18n/backend/middleware.node.mjs +3 -3
- package/dist/esm/runtime/i18n/instance.mjs +4 -2
- package/dist/esm/runtime/index.mjs +7 -6
- package/dist/esm/runtime/routerAdapter.mjs +129 -0
- package/dist/esm/runtime/utils.mjs +11 -30
- package/dist/esm/server/index.mjs +57 -7
- package/dist/esm/shared/localisedUrls.mjs +191 -0
- package/dist/esm-node/cli/index.mjs +22 -0
- package/dist/esm-node/runtime/I18nLink.mjs +4 -12
- package/dist/esm-node/runtime/context.mjs +34 -7
- package/dist/esm-node/runtime/hooks.mjs +9 -6
- package/dist/esm-node/runtime/i18n/backend/defaults.mjs +1 -1
- package/dist/esm-node/runtime/i18n/backend/middleware.node.mjs +3 -3
- package/dist/esm-node/runtime/i18n/instance.mjs +4 -2
- package/dist/esm-node/runtime/index.mjs +7 -6
- package/dist/esm-node/runtime/routerAdapter.mjs +130 -0
- package/dist/esm-node/runtime/utils.mjs +11 -30
- package/dist/esm-node/server/index.mjs +57 -7
- package/dist/esm-node/shared/localisedUrls.mjs +192 -0
- package/dist/types/cli/index.d.ts +21 -0
- package/dist/types/runtime/I18nLink.d.ts +23 -0
- package/dist/types/runtime/context.d.ts +41 -0
- package/dist/types/runtime/hooks.d.ts +30 -0
- package/dist/types/runtime/i18n/backend/config.d.ts +2 -0
- package/dist/types/runtime/i18n/backend/defaults.d.ts +13 -0
- package/dist/types/runtime/i18n/backend/defaults.node.d.ts +8 -0
- package/dist/types/runtime/i18n/backend/index.d.ts +3 -0
- package/dist/types/runtime/i18n/backend/middleware.common.d.ts +14 -0
- package/dist/types/runtime/i18n/backend/middleware.d.ts +12 -0
- package/dist/types/runtime/i18n/backend/middleware.node.d.ts +13 -0
- package/dist/types/runtime/i18n/backend/sdk-backend.d.ts +53 -0
- package/dist/types/runtime/i18n/backend/sdk-event.d.ts +9 -0
- package/dist/types/runtime/i18n/detection/config.d.ts +11 -0
- package/dist/types/runtime/i18n/detection/index.d.ts +50 -0
- package/dist/types/runtime/i18n/detection/middleware.d.ts +24 -0
- package/dist/types/runtime/i18n/detection/middleware.node.d.ts +17 -0
- package/dist/types/runtime/i18n/index.d.ts +3 -0
- package/dist/types/runtime/i18n/instance.d.ts +96 -0
- package/dist/types/runtime/i18n/utils.d.ts +29 -0
- package/dist/types/runtime/index.d.ts +21 -0
- package/dist/types/runtime/routerAdapter.d.ts +26 -0
- package/dist/types/runtime/types.d.ts +15 -0
- package/dist/types/runtime/utils.d.ts +28 -0
- package/dist/types/server/index.d.ts +14 -0
- package/dist/types/shared/deepMerge.d.ts +1 -0
- package/dist/types/shared/detection.d.ts +11 -0
- package/dist/types/shared/localisedUrls.d.ts +13 -0
- package/dist/types/shared/type.d.ts +168 -0
- package/dist/types/shared/utils.d.ts +5 -0
- package/package.json +15 -15
- package/rstest.config.mts +39 -0
- package/src/cli/index.ts +43 -1
- package/src/runtime/I18nLink.tsx +10 -16
- package/src/runtime/context.tsx +45 -7
- package/src/runtime/hooks.ts +13 -4
- package/src/runtime/i18n/backend/defaults.ts +3 -1
- package/src/runtime/i18n/backend/middleware.node.ts +1 -1
- package/src/runtime/i18n/instance.ts +14 -5
- package/src/runtime/index.tsx +10 -2
- package/src/runtime/routerAdapter.tsx +333 -0
- package/src/runtime/utils.ts +22 -34
- package/src/server/index.ts +135 -10
- package/src/shared/localisedUrls.ts +393 -0
- package/src/shared/type.ts +12 -0
- package/tests/localisedUrls.test.ts +278 -0
- package/tests/routerAdapter.test.tsx +278 -0
- package/dist/esm/rslib-runtime.mjs +0 -18
- package/dist/esm-node/rslib-runtime.mjs +0 -19
package/dist/cjs/cli/index.js
CHANGED
|
@@ -41,6 +41,7 @@ const external_fs_namespaceObject = require("fs");
|
|
|
41
41
|
var external_fs_default = /*#__PURE__*/ __webpack_require__.n(external_fs_namespaceObject);
|
|
42
42
|
const external_path_namespaceObject = require("path");
|
|
43
43
|
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
44
|
+
const localisedUrls_js_namespaceObject = require("../shared/localisedUrls.js");
|
|
44
45
|
const utils_js_namespaceObject = require("../shared/utils.js");
|
|
45
46
|
function hasJsonFiles(dirPath) {
|
|
46
47
|
try {
|
|
@@ -120,6 +121,27 @@ const i18nPlugin = (options = {})=>({
|
|
|
120
121
|
plugins
|
|
121
122
|
};
|
|
122
123
|
});
|
|
124
|
+
api.modifyFileSystemRoutes(({ entrypoint, routes })=>{
|
|
125
|
+
if (!localeDetection) return {
|
|
126
|
+
entrypoint,
|
|
127
|
+
routes
|
|
128
|
+
};
|
|
129
|
+
const localeDetectionOptions = (0, utils_js_namespaceObject.getLocaleDetectionOptions)(entrypoint.entryName, localeDetection);
|
|
130
|
+
const { localePathRedirect, languages = [], localisedUrls } = localeDetectionOptions;
|
|
131
|
+
if (!localePathRedirect || 0 === languages.length) return {
|
|
132
|
+
entrypoint,
|
|
133
|
+
routes
|
|
134
|
+
};
|
|
135
|
+
const localisedUrlsConfig = (0, localisedUrls_js_namespaceObject.resolveLocalisedUrlsConfig)(localisedUrls);
|
|
136
|
+
if (!localisedUrlsConfig.enabled) return {
|
|
137
|
+
entrypoint,
|
|
138
|
+
routes
|
|
139
|
+
};
|
|
140
|
+
return {
|
|
141
|
+
entrypoint,
|
|
142
|
+
routes: (0, localisedUrls_js_namespaceObject.applyLocalisedUrlsToRoutes)(routes, languages, localisedUrlsConfig.map)
|
|
143
|
+
};
|
|
144
|
+
});
|
|
123
145
|
api._internalServerPlugins(({ plugins })=>{
|
|
124
146
|
const { serverRoutes, metaName } = api.getAppContext();
|
|
125
147
|
const normalizedConfig = api.getNormalizedConfig();
|
|
@@ -28,22 +28,14 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
28
28
|
default: ()=>runtime_I18nLink
|
|
29
29
|
});
|
|
30
30
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
31
|
-
const router_namespaceObject = require("@modern-js/runtime/router");
|
|
32
31
|
const external_context_js_namespaceObject = require("./context.js");
|
|
32
|
+
const external_routerAdapter_js_namespaceObject = require("./routerAdapter.js");
|
|
33
33
|
const external_utils_js_namespaceObject = require("./utils.js");
|
|
34
|
-
const useRouterHooks = ()=>{
|
|
35
|
-
const inRouter = (0, router_namespaceObject.useInRouterContext)();
|
|
36
|
-
return {
|
|
37
|
-
Link: inRouter ? router_namespaceObject.Link : null,
|
|
38
|
-
params: inRouter ? (0, router_namespaceObject.useParams)() : {},
|
|
39
|
-
hasRouter: inRouter
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
34
|
const I18nLink = ({ to, children, ...props })=>{
|
|
43
|
-
const { Link, params, hasRouter } =
|
|
44
|
-
const { language, supportedLanguages } = (0, external_context_js_namespaceObject.useModernI18n)();
|
|
35
|
+
const { Link, params, hasRouter } = (0, external_routerAdapter_js_namespaceObject.useI18nRouterAdapter)();
|
|
36
|
+
const { language, supportedLanguages, localisedUrls } = (0, external_context_js_namespaceObject.useModernI18n)();
|
|
45
37
|
const currentLang = language;
|
|
46
|
-
const localizedTo = (0, external_utils_js_namespaceObject.buildLocalizedUrl)(to, currentLang, supportedLanguages);
|
|
38
|
+
const localizedTo = (0, external_utils_js_namespaceObject.buildLocalizedUrl)(to, currentLang, supportedLanguages, localisedUrls);
|
|
47
39
|
if ('development' === process.env.NODE_ENV && hasRouter && !params.lang) console.warn("I18nLink is being used outside of a :lang dynamic route context. This may cause unexpected behavior. Please ensure I18nLink is used within a route that has a :lang parameter.");
|
|
48
40
|
if (!hasRouter || !Link) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("a", {
|
|
49
41
|
href: localizedTo,
|
|
@@ -31,6 +31,7 @@ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
|
31
31
|
const runtime_namespaceObject = require("@modern-js/runtime");
|
|
32
32
|
const external_react_namespaceObject = require("react");
|
|
33
33
|
const index_js_namespaceObject = require("./i18n/detection/index.js");
|
|
34
|
+
const external_routerAdapter_js_namespaceObject = require("./routerAdapter.js");
|
|
34
35
|
const external_utils_js_namespaceObject = require("./utils.js");
|
|
35
36
|
const ModernI18nContext = /*#__PURE__*/ (0, external_react_namespaceObject.createContext)(null);
|
|
36
37
|
const ModernI18nProvider = ({ children, value })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ModernI18nContext.Provider, {
|
|
@@ -40,9 +41,33 @@ const ModernI18nProvider = ({ children, value })=>/*#__PURE__*/ (0, jsx_runtime_
|
|
|
40
41
|
const useModernI18n = ()=>{
|
|
41
42
|
const context = (0, external_react_namespaceObject.useContext)(ModernI18nContext);
|
|
42
43
|
if (!context) throw new Error('useModernI18n must be used within a ModernI18nProvider');
|
|
43
|
-
const { language: contextLanguage, i18nInstance, languages, localePathRedirect, ignoreRedirectRoutes, updateLanguage } = context;
|
|
44
|
-
const { navigate, location, hasRouter } = (0,
|
|
45
|
-
const
|
|
44
|
+
const { language: contextLanguage, i18nInstance, languages, localePathRedirect, ignoreRedirectRoutes, localisedUrls, updateLanguage } = context;
|
|
45
|
+
const { navigate, location, hasRouter } = (0, external_routerAdapter_js_namespaceObject.useI18nRouterAdapter)();
|
|
46
|
+
const pathLanguage = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
47
|
+
if (!localePathRedirect || !location?.pathname) return;
|
|
48
|
+
const detected = (0, external_utils_js_namespaceObject.detectLanguageFromPath)(location.pathname, languages || [], localePathRedirect);
|
|
49
|
+
return detected.detected ? detected.language : void 0;
|
|
50
|
+
}, [
|
|
51
|
+
languages,
|
|
52
|
+
localePathRedirect,
|
|
53
|
+
location?.pathname
|
|
54
|
+
]);
|
|
55
|
+
const currentLanguage = pathLanguage || contextLanguage;
|
|
56
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
57
|
+
if (!pathLanguage || pathLanguage === contextLanguage) return;
|
|
58
|
+
updateLanguage?.(pathLanguage);
|
|
59
|
+
i18nInstance?.setLang?.(pathLanguage);
|
|
60
|
+
i18nInstance?.changeLanguage?.(pathLanguage);
|
|
61
|
+
if ((0, runtime_namespaceObject.isBrowser)()) {
|
|
62
|
+
const detectionOptions = i18nInstance.options?.detection;
|
|
63
|
+
(0, index_js_namespaceObject.cacheUserLanguage)(i18nInstance, pathLanguage, detectionOptions);
|
|
64
|
+
}
|
|
65
|
+
}, [
|
|
66
|
+
contextLanguage,
|
|
67
|
+
i18nInstance,
|
|
68
|
+
pathLanguage,
|
|
69
|
+
updateLanguage
|
|
70
|
+
]);
|
|
46
71
|
const changeLanguage = (0, external_react_namespaceObject.useCallback)(async (newLang)=>{
|
|
47
72
|
try {
|
|
48
73
|
if (!newLang || 'string' != typeof newLang) throw new Error('Language must be a non-empty string');
|
|
@@ -59,7 +84,7 @@ const useModernI18n = ()=>{
|
|
|
59
84
|
const pathLanguage = (0, external_utils_js_namespaceObject.detectLanguageFromPath)(currentPath, languages || [], localePathRedirect);
|
|
60
85
|
if (pathLanguage.detected && pathLanguage.language === newLang) return;
|
|
61
86
|
if (!(0, external_utils_js_namespaceObject.shouldIgnoreRedirect)(relativePath, languages || [], ignoreRedirectRoutes)) {
|
|
62
|
-
const newPath = (0, external_utils_js_namespaceObject.buildLocalizedUrl)(relativePath, newLang, languages || []);
|
|
87
|
+
const newPath = (0, external_utils_js_namespaceObject.buildLocalizedUrl)(relativePath, newLang, languages || [], localisedUrls);
|
|
63
88
|
const newUrl = entryPath + newPath + location.search + location.hash;
|
|
64
89
|
await navigate(newUrl, {
|
|
65
90
|
replace: true
|
|
@@ -72,7 +97,7 @@ const useModernI18n = ()=>{
|
|
|
72
97
|
const pathLanguage = (0, external_utils_js_namespaceObject.detectLanguageFromPath)(currentPath, languages || [], localePathRedirect);
|
|
73
98
|
if (pathLanguage.detected && pathLanguage.language === newLang) return;
|
|
74
99
|
if (!(0, external_utils_js_namespaceObject.shouldIgnoreRedirect)(relativePath, languages || [], ignoreRedirectRoutes)) {
|
|
75
|
-
const newPath = (0, external_utils_js_namespaceObject.buildLocalizedUrl)(relativePath, newLang, languages || []);
|
|
100
|
+
const newPath = (0, external_utils_js_namespaceObject.buildLocalizedUrl)(relativePath, newLang, languages || [], localisedUrls);
|
|
76
101
|
const newUrl = entryPath + newPath + window.location.search + window.location.hash;
|
|
77
102
|
window.history.pushState(null, '', newUrl);
|
|
78
103
|
}
|
|
@@ -87,6 +112,7 @@ const useModernI18n = ()=>{
|
|
|
87
112
|
updateLanguage,
|
|
88
113
|
localePathRedirect,
|
|
89
114
|
ignoreRedirectRoutes,
|
|
115
|
+
localisedUrls,
|
|
90
116
|
languages,
|
|
91
117
|
hasRouter,
|
|
92
118
|
navigate,
|
|
@@ -127,6 +153,7 @@ const useModernI18n = ()=>{
|
|
|
127
153
|
changeLanguage,
|
|
128
154
|
i18nInstance,
|
|
129
155
|
supportedLanguages: languages || [],
|
|
156
|
+
localisedUrls,
|
|
130
157
|
isLanguageSupported,
|
|
131
158
|
isResourcesReady
|
|
132
159
|
};
|
|
@@ -33,6 +33,7 @@ const runtime_namespaceObject = require("@modern-js/runtime");
|
|
|
33
33
|
const external_react_namespaceObject = require("react");
|
|
34
34
|
const sdk_event_js_namespaceObject = require("./i18n/backend/sdk-event.js");
|
|
35
35
|
const index_js_namespaceObject = require("./i18n/detection/index.js");
|
|
36
|
+
const external_routerAdapter_js_namespaceObject = require("./routerAdapter.js");
|
|
36
37
|
const external_utils_js_namespaceObject = require("./utils.js");
|
|
37
38
|
function createMinimalI18nInstance(language) {
|
|
38
39
|
const minimalInstance = {
|
|
@@ -45,7 +46,7 @@ function createMinimalI18nInstance(language) {
|
|
|
45
46
|
};
|
|
46
47
|
return minimalInstance;
|
|
47
48
|
}
|
|
48
|
-
function createContextValue(lang, i18nInstance, entryName, languages, localePathRedirect, ignoreRedirectRoutes, setLang) {
|
|
49
|
+
function createContextValue(lang, i18nInstance, entryName, languages, localePathRedirect, ignoreRedirectRoutes, localisedUrls, setLang) {
|
|
49
50
|
const instance = i18nInstance || createMinimalI18nInstance(lang);
|
|
50
51
|
return {
|
|
51
52
|
language: lang,
|
|
@@ -54,6 +55,7 @@ function createContextValue(lang, i18nInstance, entryName, languages, localePath
|
|
|
54
55
|
languages,
|
|
55
56
|
localePathRedirect,
|
|
56
57
|
ignoreRedirectRoutes,
|
|
58
|
+
localisedUrls,
|
|
57
59
|
updateLanguage: setLang
|
|
58
60
|
};
|
|
59
61
|
}
|
|
@@ -103,9 +105,9 @@ function useSdkResourcesLoader(i18nInstance, setForceUpdate) {
|
|
|
103
105
|
setForceUpdate
|
|
104
106
|
]);
|
|
105
107
|
}
|
|
106
|
-
function useClientSideRedirect(i18nInstance, localePathRedirect, languages, fallbackLanguage, ignoreRedirectRoutes) {
|
|
108
|
+
function useClientSideRedirect(i18nInstance, localePathRedirect, languages, fallbackLanguage, ignoreRedirectRoutes, localisedUrls) {
|
|
107
109
|
const hasRedirectedRef = (0, external_react_namespaceObject.useRef)(false);
|
|
108
|
-
const { navigate, location, hasRouter } = (0,
|
|
110
|
+
const { navigate, location, hasRouter } = (0, external_routerAdapter_js_namespaceObject.useI18nRouterAdapter)();
|
|
109
111
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
110
112
|
if ('browser' !== process.env.MODERN_TARGET) return;
|
|
111
113
|
if (!localePathRedirect || !i18nInstance) return;
|
|
@@ -124,7 +126,7 @@ function useClientSideRedirect(i18nInstance, localePathRedirect, languages, fall
|
|
|
124
126
|
const pathDetection = (0, external_utils_js_namespaceObject.detectLanguageFromPath)(currentPathname, languages, localePathRedirect);
|
|
125
127
|
if (pathDetection.detected) return;
|
|
126
128
|
const targetLanguage = i18nInstance.language || fallbackLanguage || languages[0] || 'en';
|
|
127
|
-
const newPath = (0, external_utils_js_namespaceObject.buildLocalizedUrl)(relativePath, targetLanguage, languages);
|
|
129
|
+
const newPath = (0, external_utils_js_namespaceObject.buildLocalizedUrl)(relativePath, targetLanguage, languages, localisedUrls);
|
|
128
130
|
const newUrl = entryPath + newPath + currentSearch + currentHash;
|
|
129
131
|
if (newUrl !== currentPathname + currentSearch + currentHash) {
|
|
130
132
|
hasRedirectedRef.current = true;
|
|
@@ -141,7 +143,8 @@ function useClientSideRedirect(i18nInstance, localePathRedirect, languages, fall
|
|
|
141
143
|
i18nInstance,
|
|
142
144
|
languages,
|
|
143
145
|
fallbackLanguage,
|
|
144
|
-
ignoreRedirectRoutes
|
|
146
|
+
ignoreRedirectRoutes,
|
|
147
|
+
localisedUrls
|
|
145
148
|
]);
|
|
146
149
|
}
|
|
147
150
|
function useLanguageSync(i18nInstance, localePathRedirect, languages, runtimeContextRef, prevLangRef, setLang) {
|
|
@@ -33,7 +33,7 @@ const DEFAULT_I18NEXT_BACKEND_OPTIONS = {
|
|
|
33
33
|
};
|
|
34
34
|
function convertPath(path) {
|
|
35
35
|
if (!path) return path;
|
|
36
|
-
if (path.startsWith('/')) return `${window.__assetPrefix__ || ''}${path}`;
|
|
36
|
+
if (path.startsWith('/')) return "u" < typeof window ? path : `${window.__assetPrefix__ || ''}${path}`;
|
|
37
37
|
return path;
|
|
38
38
|
}
|
|
39
39
|
function convertBackendOptions(options) {
|
|
@@ -37,14 +37,14 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
37
37
|
HttpBackendWithSave: ()=>HttpBackendWithSave,
|
|
38
38
|
useI18nextBackend: ()=>useI18nextBackend
|
|
39
39
|
});
|
|
40
|
-
const
|
|
41
|
-
var
|
|
40
|
+
const cjs_namespaceObject = require("i18next-fs-backend/cjs");
|
|
41
|
+
var cjs_default = /*#__PURE__*/ __webpack_require__.n(cjs_namespaceObject);
|
|
42
42
|
const external_middleware_common_js_namespaceObject = require("./middleware.common.js");
|
|
43
|
-
class FsBackendWithSave extends
|
|
43
|
+
class FsBackendWithSave extends cjs_default() {
|
|
44
44
|
save(_language, _namespace, _data) {}
|
|
45
45
|
}
|
|
46
46
|
const HttpBackendWithSave = FsBackendWithSave;
|
|
47
|
-
const useI18nextBackend = (i18nInstance, backend)=>(0, external_middleware_common_js_namespaceObject.useI18nextBackendCommon)(i18nInstance, FsBackendWithSave,
|
|
47
|
+
const useI18nextBackend = (i18nInstance, backend)=>(0, external_middleware_common_js_namespaceObject.useI18nextBackendCommon)(i18nInstance, FsBackendWithSave, cjs_default(), backend);
|
|
48
48
|
exports.FsBackendWithSave = __webpack_exports__.FsBackendWithSave;
|
|
49
49
|
exports.HttpBackendWithSave = __webpack_exports__.HttpBackendWithSave;
|
|
50
50
|
exports.useI18nextBackend = __webpack_exports__.useI18nextBackend;
|
|
@@ -75,10 +75,12 @@ async function createI18nextInstance() {
|
|
|
75
75
|
return null;
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
+
function getOptionalReactI18nextPackageName() {
|
|
79
|
+
return "react-i18next";
|
|
80
|
+
}
|
|
78
81
|
async function tryImportReactI18next() {
|
|
79
82
|
try {
|
|
80
|
-
|
|
81
|
-
return reactI18next;
|
|
83
|
+
return await import(getOptionalReactI18nextPackageName());
|
|
82
84
|
} catch (error) {
|
|
83
85
|
return null;
|
|
84
86
|
}
|
|
@@ -49,8 +49,8 @@ const external_I18nLink_js_namespaceObject = require("./I18nLink.js");
|
|
|
49
49
|
const i18nPlugin = (options)=>({
|
|
50
50
|
name: '@modern-js/plugin-i18n',
|
|
51
51
|
setup: (api)=>{
|
|
52
|
-
const { entryName, i18nInstance: userI18nInstance, initOptions, localeDetection, backend, htmlLangAttr = false } = options;
|
|
53
|
-
const { localePathRedirect = false, i18nextDetector = true, languages = [], fallbackLanguage = 'en', detection, ignoreRedirectRoutes } = localeDetection || {};
|
|
52
|
+
const { entryName, i18nInstance: userI18nInstance, initOptions, localeDetection, backend, htmlLangAttr = false, reactI18next = true } = options;
|
|
53
|
+
const { localePathRedirect = false, i18nextDetector = true, languages = [], fallbackLanguage = 'en', detection, ignoreRedirectRoutes, localisedUrls } = localeDetection || {};
|
|
54
54
|
const { enabled: backendEnabled = false } = backend || {};
|
|
55
55
|
let latestI18nInstance;
|
|
56
56
|
let I18nextProvider;
|
|
@@ -59,8 +59,8 @@ const i18nPlugin = (options)=>({
|
|
|
59
59
|
const { i18n: otherConfig } = api.getRuntimeConfig();
|
|
60
60
|
const { initOptions: otherInitOptions } = otherConfig || {};
|
|
61
61
|
const userInitOptions = (0, merge_namespaceObject.merge)(otherInitOptions || {}, initOptions || {});
|
|
62
|
-
const initReactI18next = await (0, instance_js_namespaceObject.getInitReactI18next)();
|
|
63
|
-
I18nextProvider = await (0, instance_js_namespaceObject.getI18nextProvider)();
|
|
62
|
+
const initReactI18next = reactI18next ? await (0, instance_js_namespaceObject.getInitReactI18next)() : null;
|
|
63
|
+
I18nextProvider = reactI18next ? await (0, instance_js_namespaceObject.getI18nextProvider)() : null;
|
|
64
64
|
if (initReactI18next) i18nInstance.use(initReactI18next);
|
|
65
65
|
const pathname = (0, external_utils_js_namespaceObject.getPathname)(context);
|
|
66
66
|
if (i18nextDetector) (0, detection_middleware_js_namespaceObject.useI18nextLanguageDetector)(i18nInstance);
|
|
@@ -121,14 +121,15 @@ const i18nPlugin = (options)=>({
|
|
|
121
121
|
]);
|
|
122
122
|
(0, external_hooks_js_namespaceObject.useSdkResourcesLoader)(i18nInstance, setForceUpdate);
|
|
123
123
|
(0, external_hooks_js_namespaceObject.useLanguageSync)(i18nInstance, localePathRedirect, languages, runtimeContextRef, prevLangRef, setLang);
|
|
124
|
-
(0, external_hooks_js_namespaceObject.useClientSideRedirect)(i18nInstance, localePathRedirect, languages, fallbackLanguage, ignoreRedirectRoutes);
|
|
125
|
-
const contextValue = (0, external_react_namespaceObject.useMemo)(()=>(0, external_hooks_js_namespaceObject.createContextValue)(lang, i18nInstance, entryName, languages, localePathRedirect, ignoreRedirectRoutes, setLang), [
|
|
124
|
+
(0, external_hooks_js_namespaceObject.useClientSideRedirect)(i18nInstance, localePathRedirect, languages, fallbackLanguage, ignoreRedirectRoutes, localisedUrls);
|
|
125
|
+
const contextValue = (0, external_react_namespaceObject.useMemo)(()=>(0, external_hooks_js_namespaceObject.createContextValue)(lang, i18nInstance, entryName, languages, localePathRedirect, ignoreRedirectRoutes, localisedUrls, setLang), [
|
|
126
126
|
lang,
|
|
127
127
|
i18nInstance,
|
|
128
128
|
entryName,
|
|
129
129
|
languages,
|
|
130
130
|
localePathRedirect,
|
|
131
131
|
ignoreRedirectRoutes,
|
|
132
|
+
localisedUrls,
|
|
132
133
|
forceUpdate
|
|
133
134
|
]);
|
|
134
135
|
const appContent = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
useI18nRouterAdapter: ()=>useI18nRouterAdapter
|
|
28
|
+
});
|
|
29
|
+
const runtime_namespaceObject = require("@modern-js/runtime");
|
|
30
|
+
const context_namespaceObject = require("@modern-js/runtime/context");
|
|
31
|
+
const router_namespaceObject = require("@modern-js/runtime/router");
|
|
32
|
+
const external_react_namespaceObject = require("react");
|
|
33
|
+
const normalizeUrlPart = (value, prefix)=>{
|
|
34
|
+
if ('string' != typeof value || !value) return '';
|
|
35
|
+
return value.startsWith(prefix) ? value : `${prefix}${value}`;
|
|
36
|
+
};
|
|
37
|
+
const normalizeLocation = (location)=>{
|
|
38
|
+
if (!location || 'object' != typeof location) return null;
|
|
39
|
+
const locationValue = location;
|
|
40
|
+
if ('string' != typeof locationValue.pathname) return null;
|
|
41
|
+
return {
|
|
42
|
+
pathname: locationValue.pathname,
|
|
43
|
+
search: normalizeUrlPart('string' == typeof locationValue.search ? locationValue.search : locationValue.searchStr, '?'),
|
|
44
|
+
hash: normalizeUrlPart(locationValue.hash, '#')
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
const getWindowLocation = ()=>{
|
|
48
|
+
if (!(0, runtime_namespaceObject.isBrowser)()) return null;
|
|
49
|
+
return {
|
|
50
|
+
pathname: window.location.pathname,
|
|
51
|
+
search: window.location.search,
|
|
52
|
+
hash: window.location.hash
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
const getRouterFramework = (runtimeContext, internalContext, inReactRouter)=>{
|
|
56
|
+
const framework = internalContext.routerFramework || internalContext.routerRuntime?.framework || runtimeContext.routerFramework;
|
|
57
|
+
if (framework) return framework;
|
|
58
|
+
if (internalContext.router?.useRouter || runtimeContext.router?.useRouter) return 'tanstack';
|
|
59
|
+
if (internalContext.router?.useLocation || internalContext.router?.useHref || runtimeContext.router?.useLocation || runtimeContext.router?.useHref) return 'react-router';
|
|
60
|
+
if (inReactRouter) return 'react-router';
|
|
61
|
+
};
|
|
62
|
+
const getRouterInstance = (internalContext, contextRouter)=>{
|
|
63
|
+
if (contextRouter) return contextRouter;
|
|
64
|
+
const router = internalContext.routerInstance || internalContext.routerRuntime?.instance;
|
|
65
|
+
if (!router || 'object' != typeof router) return null;
|
|
66
|
+
return router;
|
|
67
|
+
};
|
|
68
|
+
const getRouterStateLocation = (internalContext, contextRouter)=>{
|
|
69
|
+
const router = getRouterInstance(internalContext, contextRouter);
|
|
70
|
+
return normalizeLocation(router?.stores?.location?.get?.()) || normalizeLocation(router?.state?.location);
|
|
71
|
+
};
|
|
72
|
+
const getRouterParams = (internalContext, contextRouter)=>{
|
|
73
|
+
const router = getRouterInstance(internalContext, contextRouter);
|
|
74
|
+
const matches = router?.stores?.matches?.get?.() || router?.state?.matches;
|
|
75
|
+
if (!Array.isArray(matches)) return {};
|
|
76
|
+
return matches.reduce((params, match)=>{
|
|
77
|
+
if (match?.params) Object.assign(params, match.params);
|
|
78
|
+
return params;
|
|
79
|
+
}, {});
|
|
80
|
+
};
|
|
81
|
+
const useI18nRouterAdapter = ()=>{
|
|
82
|
+
const runtimeContext = (0, external_react_namespaceObject.useContext)(runtime_namespaceObject.RuntimeContext);
|
|
83
|
+
const internalContext = (0, external_react_namespaceObject.useContext)(context_namespaceObject.InternalRuntimeContext);
|
|
84
|
+
const inReactRouter = (0, router_namespaceObject.useInRouterContext)();
|
|
85
|
+
const reactRouterNavigate = inReactRouter ? (0, router_namespaceObject.useNavigate)() : null;
|
|
86
|
+
const reactRouterLocation = inReactRouter ? (0, router_namespaceObject.useLocation)() : null;
|
|
87
|
+
const reactRouterParams = inReactRouter ? (0, router_namespaceObject.useParams)() : {};
|
|
88
|
+
const framework = getRouterFramework(runtimeContext, internalContext, inReactRouter);
|
|
89
|
+
const contextUseRouter = inReactRouter || 'tanstack' !== framework ? void 0 : internalContext.router?.useRouter || runtimeContext.router?.useRouter;
|
|
90
|
+
const contextRouter = contextUseRouter ? contextUseRouter({
|
|
91
|
+
warn: false
|
|
92
|
+
}) : null;
|
|
93
|
+
const [, setRouterVersion] = (0, external_react_namespaceObject.useState)(0);
|
|
94
|
+
const hasRouter = 'tanstack' === framework || 'react-router' === framework || Boolean(reactRouterNavigate);
|
|
95
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
96
|
+
if ('tanstack' !== framework) return;
|
|
97
|
+
const router = getRouterInstance(internalContext, contextRouter);
|
|
98
|
+
if (!router) return;
|
|
99
|
+
const update = ()=>setRouterVersion((version)=>version + 1);
|
|
100
|
+
const unsubscribers = [];
|
|
101
|
+
if ('function' == typeof router.stores?.location?.subscribe) {
|
|
102
|
+
const unsubscribe = router.stores.location.subscribe(update);
|
|
103
|
+
if ('function' == typeof unsubscribe) unsubscribers.push(unsubscribe);
|
|
104
|
+
}
|
|
105
|
+
if ('function' == typeof router.subscribe) for (const eventType of [
|
|
106
|
+
'onBeforeNavigate',
|
|
107
|
+
'onBeforeLoad'
|
|
108
|
+
]){
|
|
109
|
+
const unsubscribe = router.subscribe(eventType, update);
|
|
110
|
+
if ('function' == typeof unsubscribe) unsubscribers.push(unsubscribe);
|
|
111
|
+
}
|
|
112
|
+
return ()=>{
|
|
113
|
+
for (const unsubscribe of unsubscribers)unsubscribe();
|
|
114
|
+
};
|
|
115
|
+
}, [
|
|
116
|
+
contextRouter,
|
|
117
|
+
framework,
|
|
118
|
+
internalContext
|
|
119
|
+
]);
|
|
120
|
+
const navigate = (0, external_react_namespaceObject.useCallback)((href, options)=>{
|
|
121
|
+
const router = getRouterInstance(internalContext, contextRouter);
|
|
122
|
+
const activeFramework = getRouterFramework(runtimeContext, internalContext, inReactRouter);
|
|
123
|
+
if ('tanstack' === activeFramework) {
|
|
124
|
+
if ('function' == typeof router?.navigate) return router.navigate({
|
|
125
|
+
to: href,
|
|
126
|
+
replace: options?.replace,
|
|
127
|
+
...options?.state === void 0 ? {} : {
|
|
128
|
+
state: options.state
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
throw new Error('TanStack router instance is not available.');
|
|
132
|
+
}
|
|
133
|
+
if (reactRouterNavigate) return reactRouterNavigate(href, options);
|
|
134
|
+
if ('react-router' === activeFramework) {
|
|
135
|
+
if ('function' == typeof router?.navigate) return router.navigate(href, options);
|
|
136
|
+
throw new Error('React Router instance is not available.');
|
|
137
|
+
}
|
|
138
|
+
}, [
|
|
139
|
+
contextRouter,
|
|
140
|
+
internalContext,
|
|
141
|
+
inReactRouter,
|
|
142
|
+
reactRouterNavigate,
|
|
143
|
+
runtimeContext
|
|
144
|
+
]);
|
|
145
|
+
const location = (reactRouterLocation ? normalizeLocation(reactRouterLocation) : getRouterStateLocation(internalContext, contextRouter)) || getWindowLocation();
|
|
146
|
+
const params = inReactRouter ? reactRouterParams : getRouterParams(internalContext, contextRouter);
|
|
147
|
+
const Link = 'tanstack' === framework ? internalContext.router?.Link || runtimeContext.router?.Link || null : 'react-router' === framework || inReactRouter ? router_namespaceObject.Link : null;
|
|
148
|
+
return {
|
|
149
|
+
framework,
|
|
150
|
+
hasRouter,
|
|
151
|
+
location,
|
|
152
|
+
navigate: hasRouter ? navigate : null,
|
|
153
|
+
Link,
|
|
154
|
+
params
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
exports.useI18nRouterAdapter = __webpack_exports__.useI18nRouterAdapter;
|
|
158
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
159
|
+
"useI18nRouterAdapter"
|
|
160
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
161
|
+
Object.defineProperty(exports, '__esModule', {
|
|
162
|
+
value: true
|
|
163
|
+
});
|
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
"@modern-js/runtime/router" (module) {
|
|
4
|
-
module.exports = require("@modern-js/runtime/router");
|
|
5
|
-
}
|
|
6
|
-
};
|
|
7
|
-
var __webpack_module_cache__ = {};
|
|
8
|
-
function __webpack_require__(moduleId) {
|
|
9
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
10
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
11
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
12
|
-
exports: {}
|
|
13
|
-
};
|
|
14
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
15
|
-
return module.exports;
|
|
16
|
-
}
|
|
2
|
+
var __webpack_require__ = {};
|
|
17
3
|
(()=>{
|
|
18
4
|
__webpack_require__.d = (exports1, definition)=>{
|
|
19
5
|
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
@@ -36,100 +22,83 @@ function __webpack_require__(moduleId) {
|
|
|
36
22
|
};
|
|
37
23
|
})();
|
|
38
24
|
var __webpack_exports__ = {};
|
|
39
|
-
(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const segmentsToCheck = !entryPath && segments.length > 1 && segments[0] && !languages.includes(segments[0]) ? segments.slice(1) : segments;
|
|
81
|
-
const firstSegment = segmentsToCheck[0];
|
|
82
|
-
if (firstSegment && languages.includes(firstSegment)) return {
|
|
83
|
-
detected: true,
|
|
84
|
-
language: firstSegment
|
|
85
|
-
};
|
|
86
|
-
return {
|
|
87
|
-
detected: false
|
|
88
|
-
};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
buildLocalizedUrl: ()=>buildLocalizedUrl,
|
|
28
|
+
detectLanguageFromPath: ()=>detectLanguageFromPath,
|
|
29
|
+
getEntryPath: ()=>getEntryPath,
|
|
30
|
+
getLanguageFromPath: ()=>getLanguageFromPath,
|
|
31
|
+
getPathname: ()=>getPathname,
|
|
32
|
+
shouldIgnoreRedirect: ()=>shouldIgnoreRedirect
|
|
33
|
+
});
|
|
34
|
+
const runtime_namespaceObject = require("@modern-js/runtime");
|
|
35
|
+
const context_namespaceObject = require("@modern-js/runtime/context");
|
|
36
|
+
const localisedUrls_js_namespaceObject = require("../shared/localisedUrls.js");
|
|
37
|
+
const getPathname = (context)=>{
|
|
38
|
+
if ((0, runtime_namespaceObject.isBrowser)()) return window.location.pathname;
|
|
39
|
+
return context.ssrContext?.request?.pathname || '/';
|
|
40
|
+
};
|
|
41
|
+
const getEntryPath = ()=>{
|
|
42
|
+
const basename = (0, context_namespaceObject.getGlobalBasename)();
|
|
43
|
+
if (basename) return '/' === basename ? '' : basename;
|
|
44
|
+
return '';
|
|
45
|
+
};
|
|
46
|
+
const getLanguageFromPath = (pathname, languages, fallbackLanguage)=>{
|
|
47
|
+
const segments = pathname.split('/').filter(Boolean);
|
|
48
|
+
const firstSegment = segments[0];
|
|
49
|
+
if (languages.includes(firstSegment)) return firstSegment;
|
|
50
|
+
return fallbackLanguage;
|
|
51
|
+
};
|
|
52
|
+
const buildLocalizedUrl = (pathname, language, languages, localisedUrls)=>{
|
|
53
|
+
const segments = pathname.split('/').filter(Boolean);
|
|
54
|
+
const localisedUrlsConfig = (0, localisedUrls_js_namespaceObject.resolveLocalisedUrlsConfig)(localisedUrls);
|
|
55
|
+
const pathWithoutLanguage = segments.length > 0 && languages.includes(segments[0]) ? `/${segments.slice(1).join('/')}` : pathname;
|
|
56
|
+
const resolvedPath = localisedUrlsConfig.enabled ? (0, localisedUrls_js_namespaceObject.resolveLocalisedPath)(pathWithoutLanguage, language, languages, localisedUrlsConfig.map) : pathWithoutLanguage;
|
|
57
|
+
const resolvedSegments = resolvedPath.split('/').filter(Boolean);
|
|
58
|
+
return `/${[
|
|
59
|
+
language,
|
|
60
|
+
...resolvedSegments
|
|
61
|
+
].join('/')}`;
|
|
62
|
+
};
|
|
63
|
+
const detectLanguageFromPath = (pathname, languages, localePathRedirect)=>{
|
|
64
|
+
if (!localePathRedirect) return {
|
|
65
|
+
detected: false
|
|
89
66
|
};
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
67
|
+
const entryPath = getEntryPath();
|
|
68
|
+
const relativePath = pathname.replace(entryPath, '');
|
|
69
|
+
const segments = relativePath.split('/').filter(Boolean);
|
|
70
|
+
const segmentsToCheck = !entryPath && segments.length > 1 && segments[0] && !languages.includes(segments[0]) ? segments.slice(1) : segments;
|
|
71
|
+
const firstSegment = segmentsToCheck[0];
|
|
72
|
+
if (firstSegment && languages.includes(firstSegment)) return {
|
|
73
|
+
detected: true,
|
|
74
|
+
language: firstSegment
|
|
98
75
|
};
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const { useLocation, useNavigate, useParams } = __webpack_require__("@modern-js/runtime/router");
|
|
102
|
-
return {
|
|
103
|
-
navigate: useNavigate(),
|
|
104
|
-
location: useLocation(),
|
|
105
|
-
params: useParams(),
|
|
106
|
-
hasRouter: true
|
|
107
|
-
};
|
|
108
|
-
} catch (error) {
|
|
109
|
-
return {
|
|
110
|
-
navigate: null,
|
|
111
|
-
location: null,
|
|
112
|
-
params: {},
|
|
113
|
-
hasRouter: false
|
|
114
|
-
};
|
|
115
|
-
}
|
|
76
|
+
return {
|
|
77
|
+
detected: false
|
|
116
78
|
};
|
|
117
|
-
}
|
|
79
|
+
};
|
|
80
|
+
const shouldIgnoreRedirect = (pathname, languages, ignoreRedirectRoutes)=>{
|
|
81
|
+
if (!ignoreRedirectRoutes) return false;
|
|
82
|
+
const segments = pathname.split('/').filter(Boolean);
|
|
83
|
+
let pathWithoutLang = pathname;
|
|
84
|
+
if (segments.length > 0 && languages.includes(segments[0])) pathWithoutLang = `/${segments.slice(1).join('/')}`;
|
|
85
|
+
const normalizedPath = pathWithoutLang.startsWith('/') ? pathWithoutLang : `/${pathWithoutLang}`;
|
|
86
|
+
if ('function' == typeof ignoreRedirectRoutes) return ignoreRedirectRoutes(normalizedPath);
|
|
87
|
+
return ignoreRedirectRoutes.some((pattern)=>normalizedPath === pattern || normalizedPath.startsWith(`${pattern}/`));
|
|
88
|
+
};
|
|
118
89
|
exports.buildLocalizedUrl = __webpack_exports__.buildLocalizedUrl;
|
|
119
90
|
exports.detectLanguageFromPath = __webpack_exports__.detectLanguageFromPath;
|
|
120
91
|
exports.getEntryPath = __webpack_exports__.getEntryPath;
|
|
121
92
|
exports.getLanguageFromPath = __webpack_exports__.getLanguageFromPath;
|
|
122
93
|
exports.getPathname = __webpack_exports__.getPathname;
|
|
123
94
|
exports.shouldIgnoreRedirect = __webpack_exports__.shouldIgnoreRedirect;
|
|
124
|
-
exports.useRouterHooks = __webpack_exports__.useRouterHooks;
|
|
125
95
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
126
96
|
"buildLocalizedUrl",
|
|
127
97
|
"detectLanguageFromPath",
|
|
128
98
|
"getEntryPath",
|
|
129
99
|
"getLanguageFromPath",
|
|
130
100
|
"getPathname",
|
|
131
|
-
"shouldIgnoreRedirect"
|
|
132
|
-
"useRouterHooks"
|
|
101
|
+
"shouldIgnoreRedirect"
|
|
133
102
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
134
103
|
Object.defineProperty(exports, '__esModule', {
|
|
135
104
|
value: true
|