@bleedingdev/modern-js-plugin-i18n 3.5.0-ultramodern.4 → 3.5.0-ultramodern.41

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.
Files changed (214) hide show
  1. package/dist/cjs/cli/index.js +2 -1
  2. package/dist/cjs/cli/locales.js +15 -15
  3. package/dist/cjs/runtime/Link.js +8 -89
  4. package/dist/cjs/runtime/context.js +18 -82
  5. package/dist/cjs/runtime/contextHelpers.js +137 -0
  6. package/dist/cjs/runtime/core.js +29 -132
  7. package/dist/cjs/runtime/i18n/backend/defaults.node.js +7 -7
  8. package/dist/cjs/runtime/i18n/detection/cache.js +150 -0
  9. package/dist/cjs/runtime/i18n/detection/detector.js +100 -0
  10. package/dist/cjs/runtime/i18n/detection/index.js +8 -263
  11. package/dist/cjs/runtime/i18n/detection/initOptions.js +69 -0
  12. package/dist/cjs/runtime/i18n/detection/language.js +62 -0
  13. package/dist/cjs/runtime/i18n/detection/path.js +49 -0
  14. package/dist/cjs/runtime/i18n/detection/priority.js +66 -0
  15. package/dist/cjs/runtime/i18n/detection/ssr.js +70 -0
  16. package/dist/cjs/runtime/i18n/detection/types.js +18 -0
  17. package/dist/cjs/runtime/i18n/instance.js +7 -7
  18. package/dist/cjs/runtime/linkHelpers.js +148 -0
  19. package/dist/cjs/runtime/pluginSetup.js +102 -0
  20. package/dist/cjs/runtime/providerComposition.js +114 -0
  21. package/dist/cjs/runtime/reactI18next.js +43 -0
  22. package/dist/cjs/runtime/utils.js +1 -9
  23. package/dist/cjs/server/apiPrefix.js +72 -0
  24. package/dist/cjs/server/detectorOptions.js +97 -0
  25. package/dist/cjs/server/index.js +17 -144
  26. package/dist/cjs/server/redirectPolicy.js +96 -0
  27. package/dist/cjs/shared/detection.js +2 -104
  28. package/dist/cjs/shared/localisedUrls/config.js +49 -0
  29. package/dist/cjs/shared/localisedUrls/index.js +91 -0
  30. package/dist/cjs/shared/localisedUrls/normalise.js +87 -0
  31. package/dist/cjs/shared/localisedUrls/pathname.js +68 -0
  32. package/dist/cjs/shared/localisedUrls/patterns.js +130 -0
  33. package/dist/cjs/shared/localisedUrls/redirect.js +95 -0
  34. package/dist/cjs/shared/localisedUrls/resolve.js +88 -0
  35. package/dist/cjs/shared/localisedUrls/routes.js +129 -0
  36. package/dist/cjs/shared/localisedUrls/types.js +18 -0
  37. package/dist/cjs/shared/localisedUrls.js +28 -294
  38. package/dist/cjs/shared/utils.js +2 -8
  39. package/dist/esm/cli/index.mjs +2 -1
  40. package/dist/esm/cli/locales.mjs +13 -13
  41. package/dist/esm/runtime/Link.mjs +1 -82
  42. package/dist/esm/runtime/context.mjs +18 -82
  43. package/dist/esm/runtime/contextHelpers.mjs +84 -0
  44. package/dist/esm/runtime/core.mjs +30 -133
  45. package/dist/esm/runtime/i18n/backend/defaults.node.mjs +5 -5
  46. package/dist/esm/runtime/i18n/detection/cache.mjs +103 -0
  47. package/dist/esm/runtime/i18n/detection/detector.mjs +62 -0
  48. package/dist/esm/runtime/i18n/detection/index.mjs +4 -260
  49. package/dist/esm/runtime/i18n/detection/initOptions.mjs +28 -0
  50. package/dist/esm/runtime/i18n/detection/language.mjs +21 -0
  51. package/dist/esm/runtime/i18n/detection/path.mjs +11 -0
  52. package/dist/esm/runtime/i18n/detection/priority.mjs +28 -0
  53. package/dist/esm/runtime/i18n/detection/ssr.mjs +26 -0
  54. package/dist/esm/runtime/i18n/detection/types.mjs +0 -0
  55. package/dist/esm/runtime/i18n/instance.mjs +8 -5
  56. package/dist/esm/runtime/linkHelpers.mjs +98 -0
  57. package/dist/esm/runtime/pluginSetup.mjs +64 -0
  58. package/dist/esm/runtime/providerComposition.mjs +76 -0
  59. package/dist/esm/runtime/reactI18next.mjs +5 -0
  60. package/dist/esm/runtime/utils.mjs +2 -10
  61. package/dist/esm/server/apiPrefix.mjs +31 -0
  62. package/dist/esm/server/detectorOptions.mjs +59 -0
  63. package/dist/esm/server/index.mjs +8 -135
  64. package/dist/esm/server/redirectPolicy.mjs +46 -0
  65. package/dist/esm/shared/detection.mjs +1 -71
  66. package/dist/esm/shared/localisedUrls/config.mjs +11 -0
  67. package/dist/esm/shared/localisedUrls/index.mjs +7 -0
  68. package/dist/esm/shared/localisedUrls/normalise.mjs +37 -0
  69. package/dist/esm/shared/localisedUrls/pathname.mjs +24 -0
  70. package/dist/esm/shared/localisedUrls/patterns.mjs +86 -0
  71. package/dist/esm/shared/localisedUrls/redirect.mjs +48 -0
  72. package/dist/esm/shared/localisedUrls/resolve.mjs +47 -0
  73. package/dist/esm/shared/localisedUrls/routes.mjs +88 -0
  74. package/dist/esm/shared/localisedUrls/types.mjs +0 -0
  75. package/dist/esm/shared/localisedUrls.mjs +1 -283
  76. package/dist/esm/shared/utils.mjs +1 -1
  77. package/dist/esm-node/cli/index.mjs +2 -1
  78. package/dist/esm-node/cli/locales.mjs +13 -13
  79. package/dist/esm-node/runtime/Link.mjs +1 -82
  80. package/dist/esm-node/runtime/context.mjs +18 -82
  81. package/dist/esm-node/runtime/contextHelpers.mjs +85 -0
  82. package/dist/esm-node/runtime/core.mjs +30 -133
  83. package/dist/esm-node/runtime/i18n/backend/defaults.node.mjs +5 -5
  84. package/dist/esm-node/runtime/i18n/detection/cache.mjs +104 -0
  85. package/dist/esm-node/runtime/i18n/detection/detector.mjs +63 -0
  86. package/dist/esm-node/runtime/i18n/detection/index.mjs +4 -260
  87. package/dist/esm-node/runtime/i18n/detection/initOptions.mjs +29 -0
  88. package/dist/esm-node/runtime/i18n/detection/language.mjs +22 -0
  89. package/dist/esm-node/runtime/i18n/detection/path.mjs +12 -0
  90. package/dist/esm-node/runtime/i18n/detection/priority.mjs +29 -0
  91. package/dist/esm-node/runtime/i18n/detection/ssr.mjs +27 -0
  92. package/dist/esm-node/runtime/i18n/detection/types.mjs +1 -0
  93. package/dist/esm-node/runtime/i18n/instance.mjs +8 -5
  94. package/dist/esm-node/runtime/linkHelpers.mjs +99 -0
  95. package/dist/esm-node/runtime/pluginSetup.mjs +65 -0
  96. package/dist/esm-node/runtime/providerComposition.mjs +77 -0
  97. package/dist/esm-node/runtime/reactI18next.mjs +6 -0
  98. package/dist/esm-node/runtime/utils.mjs +2 -10
  99. package/dist/esm-node/server/apiPrefix.mjs +32 -0
  100. package/dist/esm-node/server/detectorOptions.mjs +60 -0
  101. package/dist/esm-node/server/index.mjs +8 -135
  102. package/dist/esm-node/server/redirectPolicy.mjs +47 -0
  103. package/dist/esm-node/shared/detection.mjs +1 -71
  104. package/dist/esm-node/shared/localisedUrls/config.mjs +12 -0
  105. package/dist/esm-node/shared/localisedUrls/index.mjs +8 -0
  106. package/dist/esm-node/shared/localisedUrls/normalise.mjs +38 -0
  107. package/dist/esm-node/shared/localisedUrls/pathname.mjs +25 -0
  108. package/dist/esm-node/shared/localisedUrls/patterns.mjs +87 -0
  109. package/dist/esm-node/shared/localisedUrls/redirect.mjs +49 -0
  110. package/dist/esm-node/shared/localisedUrls/resolve.mjs +48 -0
  111. package/dist/esm-node/shared/localisedUrls/routes.mjs +89 -0
  112. package/dist/esm-node/shared/localisedUrls/types.mjs +1 -0
  113. package/dist/esm-node/shared/localisedUrls.mjs +1 -283
  114. package/dist/esm-node/shared/utils.mjs +1 -1
  115. package/dist/types/cli/locales.d.ts +1 -1
  116. package/dist/types/runtime/Link.d.ts +3 -7
  117. package/dist/types/runtime/context.d.ts +6 -5
  118. package/dist/types/runtime/contextHelpers.d.ts +28 -0
  119. package/dist/types/runtime/core.d.ts +3 -7
  120. package/dist/types/runtime/hooks.d.ts +5 -0
  121. package/dist/types/runtime/i18n/backend/middleware.common.d.ts +2 -1
  122. package/dist/types/runtime/i18n/detection/cache.d.ts +14 -0
  123. package/dist/types/runtime/i18n/detection/detector.d.ts +8 -0
  124. package/dist/types/runtime/i18n/detection/index.d.ts +5 -50
  125. package/dist/types/runtime/i18n/detection/initOptions.d.ts +10 -0
  126. package/dist/types/runtime/i18n/detection/language.d.ts +11 -0
  127. package/dist/types/runtime/i18n/detection/middleware.d.ts +4 -4
  128. package/dist/types/runtime/i18n/detection/middleware.node.d.ts +4 -4
  129. package/dist/types/runtime/i18n/detection/path.d.ts +5 -0
  130. package/dist/types/runtime/i18n/detection/priority.d.ts +10 -0
  131. package/dist/types/runtime/i18n/detection/ssr.d.ts +9 -0
  132. package/dist/types/runtime/i18n/detection/types.d.ts +32 -0
  133. package/dist/types/runtime/i18n/instance.d.ts +28 -26
  134. package/dist/types/runtime/i18n/react-i18next.d.ts +1 -6
  135. package/dist/types/runtime/i18n/utils.d.ts +14 -5
  136. package/dist/types/runtime/linkHelpers.d.ts +17 -0
  137. package/dist/types/runtime/pluginSetup.d.ts +32 -0
  138. package/dist/types/runtime/providerComposition.d.ts +16 -0
  139. package/dist/types/runtime/reactI18next.d.ts +7 -0
  140. package/dist/types/runtime/routerAdapter.d.ts +7 -6
  141. package/dist/types/runtime/utils.d.ts +7 -2
  142. package/dist/types/server/apiPrefix.d.ts +7 -0
  143. package/dist/types/server/detectorOptions.d.ts +21 -0
  144. package/dist/types/server/index.d.ts +1 -6
  145. package/dist/types/server/redirectPolicy.d.ts +22 -0
  146. package/dist/types/shared/detection.d.ts +1 -11
  147. package/dist/types/shared/localisedUrls/config.d.ts +9 -0
  148. package/dist/types/shared/localisedUrls/index.d.ts +9 -0
  149. package/dist/types/shared/localisedUrls/normalise.d.ts +10 -0
  150. package/dist/types/shared/localisedUrls/pathname.d.ts +4 -0
  151. package/dist/types/shared/localisedUrls/patterns.d.ts +5 -0
  152. package/dist/types/shared/localisedUrls/redirect.d.ts +11 -0
  153. package/dist/types/shared/localisedUrls/resolve.d.ts +7 -0
  154. package/dist/types/shared/localisedUrls/routes.d.ts +3 -0
  155. package/dist/types/shared/localisedUrls/types.d.ts +14 -0
  156. package/dist/types/shared/localisedUrls.d.ts +2 -36
  157. package/dist/types/shared/utils.d.ts +0 -2
  158. package/package.json +16 -18
  159. package/rstest.config.mts +1 -0
  160. package/src/cli/index.ts +5 -4
  161. package/src/cli/locales.ts +3 -3
  162. package/src/runtime/Link.tsx +11 -138
  163. package/src/runtime/context.tsx +45 -199
  164. package/src/runtime/contextHelpers.ts +232 -0
  165. package/src/runtime/core.tsx +43 -274
  166. package/src/runtime/hooks.ts +13 -2
  167. package/src/runtime/i18n/backend/defaults.node.ts +2 -2
  168. package/src/runtime/i18n/backend/middleware.common.ts +5 -4
  169. package/src/runtime/i18n/detection/cache.ts +189 -0
  170. package/src/runtime/i18n/detection/detector.ts +166 -0
  171. package/src/runtime/i18n/detection/index.ts +10 -641
  172. package/src/runtime/i18n/detection/initOptions.ts +74 -0
  173. package/src/runtime/i18n/detection/language.ts +64 -0
  174. package/src/runtime/i18n/detection/middleware.node.ts +26 -7
  175. package/src/runtime/i18n/detection/middleware.ts +15 -7
  176. package/src/runtime/i18n/detection/path.ts +41 -0
  177. package/src/runtime/i18n/detection/priority.ts +82 -0
  178. package/src/runtime/i18n/detection/ssr.ts +47 -0
  179. package/src/runtime/i18n/detection/types.ts +41 -0
  180. package/src/runtime/i18n/instance.ts +56 -31
  181. package/src/runtime/i18n/react-i18next.ts +1 -6
  182. package/src/runtime/i18n/utils.ts +18 -9
  183. package/src/runtime/linkHelpers.ts +174 -0
  184. package/src/runtime/pluginSetup.ts +189 -0
  185. package/src/runtime/providerComposition.tsx +144 -0
  186. package/src/runtime/reactI18next.ts +20 -0
  187. package/src/runtime/routerAdapter.tsx +6 -6
  188. package/src/runtime/utils.ts +13 -35
  189. package/src/server/apiPrefix.ts +67 -0
  190. package/src/server/detectorOptions.ts +105 -0
  191. package/src/server/index.ts +14 -319
  192. package/src/server/redirectPolicy.ts +127 -0
  193. package/src/shared/detection.ts +1 -1
  194. package/src/shared/localisedUrls/config.ts +18 -0
  195. package/src/shared/localisedUrls/index.ts +24 -0
  196. package/src/shared/localisedUrls/normalise.ts +67 -0
  197. package/src/shared/localisedUrls/pathname.ts +60 -0
  198. package/src/shared/localisedUrls/patterns.ts +160 -0
  199. package/src/shared/localisedUrls/redirect.ts +91 -0
  200. package/src/shared/localisedUrls/resolve.ts +135 -0
  201. package/src/shared/localisedUrls/routes.ts +226 -0
  202. package/src/shared/localisedUrls/types.ts +18 -0
  203. package/src/shared/localisedUrls.ts +26 -623
  204. package/src/shared/utils.ts +2 -2
  205. package/tests/fixtures/localised-routes.golden.json +156 -0
  206. package/tests/link.test.tsx +111 -0
  207. package/tests/linkTypes.test.ts +15 -4
  208. package/tests/localisedUrlRewriteMatrix.fork.test.ts +147 -0
  209. package/tests/localisedUrls.test.ts +129 -2
  210. package/tests/reactI18nextRuntimeBoundary.test.ts +6 -3
  211. package/tests/redirectPolicy.test.ts +43 -0
  212. package/tests/routerAdapter.test.tsx +85 -0
  213. package/tests/type-fixture/fixture-globals.d.ts +11 -0
  214. package/tests/type-fixture/tsconfig.json +1 -0
@@ -1,50 +1,5 @@
1
- import { type TRuntimeContext } from '@modern-js/runtime';
2
- import type { I18nInitOptions, I18nInstance, LanguageDetectorOptions } from '../instance';
3
- import { cacheUserLanguage } from './middleware';
4
- export { cacheUserLanguage };
5
- export declare function exportServerLngToWindow(context: TRuntimeContext, lng: string): void;
6
- export declare const getLanguageFromSSRData: (window: Window) => string | undefined;
7
- export interface BaseLanguageDetectionOptions {
8
- languages: string[];
9
- fallbackLanguage: string;
10
- localePathRedirect: boolean;
11
- i18nextDetector: boolean;
12
- detection?: LanguageDetectorOptions;
13
- userInitOptions?: I18nInitOptions;
14
- mergedBackend?: any;
15
- }
16
- export interface LanguageDetectionOptions extends BaseLanguageDetectionOptions {
17
- pathname: string;
18
- ssrContext?: any;
19
- }
20
- export interface LanguageDetectionResult {
21
- detectedLanguage?: string;
22
- finalLanguage: string;
23
- }
24
- /**
25
- * Detect language with priority:
26
- * Priority 1: SSR data (try window._SSR_DATA first, works for both SSR and CSR)
27
- * Priority 2: Path detection
28
- * Priority 3: i18next detector (reads from cookie/localStorage)
29
- * Priority 4: User config language or fallback
30
- */
31
- export declare const detectLanguageWithPriority: (i18nInstance: I18nInstance, options: LanguageDetectionOptions) => Promise<LanguageDetectionResult>;
32
- /**
33
- * Options for building i18n init options
34
- */
35
- export interface BuildInitOptionsParams {
36
- finalLanguage: string;
37
- fallbackLanguage: string;
38
- languages: string[];
39
- userInitOptions?: I18nInitOptions;
40
- mergedDetection?: any;
41
- mergeBackend?: any;
42
- }
43
- /**
44
- * Build i18n initialization options
45
- */
46
- export declare const buildInitOptions: (params: BuildInitOptionsParams) => I18nInitOptions;
47
- /**
48
- * Merge detection and backend options
49
- */
50
- export declare const mergeDetectionOptions: (i18nextDetector: boolean, detection?: LanguageDetectorOptions, localePathRedirect?: boolean, userInitOptions?: I18nInitOptions) => LanguageDetectorOptions;
1
+ export { buildInitOptions, mergeDetectionOptions } from './initOptions';
2
+ export { cacheUserLanguage } from './middleware';
3
+ export { detectLanguageWithPriority } from './priority';
4
+ export { exportServerLngToWindow, getLanguageFromSSRData } from './ssr';
5
+ export type { BaseLanguageDetectionOptions, BuildInitOptionsParams, LanguageDetectionOptions, LanguageDetectionResult, } from './types';
@@ -0,0 +1,10 @@
1
+ import type { I18nInitOptions, LanguageDetectorOptions } from '../instance';
2
+ import type { BuildInitOptionsParams } from './types';
3
+ /**
4
+ * Build i18n initialization options
5
+ */
6
+ export declare const buildInitOptions: (params: BuildInitOptionsParams) => I18nInitOptions;
7
+ /**
8
+ * Merge detection and backend options
9
+ */
10
+ export declare const mergeDetectionOptions: (i18nextDetector: boolean, detection?: LanguageDetectorOptions, localePathRedirect?: boolean, userInitOptions?: I18nInitOptions) => LanguageDetectorOptions;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Check if a language is supported
3
+ * Also checks the base language code (e.g., 'zh-CN' matches 'zh')
4
+ */
5
+ export declare const isLanguageSupported: (language: string | undefined, supportedLanguages: string[]) => boolean;
6
+ /**
7
+ * Get the supported language that matches the given language
8
+ * Returns the exact match if available, otherwise returns the base language code match
9
+ * Returns undefined if no match is found
10
+ */
11
+ export declare const getSupportedLanguage: (language: string | undefined, supportedLanguages: string[]) => string | undefined;
@@ -1,4 +1,4 @@
1
- import type { I18nInstance } from '../instance';
1
+ import type { I18nInstance, LanguageDetectorOptions } from '../instance';
2
2
  /**
3
3
  * Register LanguageDetector plugin to i18n instance
4
4
  * Must be called before init() to properly register the detector
@@ -9,16 +9,16 @@ export declare const useI18nextLanguageDetector: (i18nInstance: I18nInstance) =>
9
9
  * Read language directly from localStorage/cookie
10
10
  * Fallback when detector is not available in services
11
11
  */
12
- export declare const readLanguageFromStorage: (detectionOptions?: any) => string | undefined;
12
+ export declare const readLanguageFromStorage: (detectionOptions?: LanguageDetectorOptions) => string | undefined;
13
13
  /**
14
14
  * Detect language using i18next-browser-languagedetector
15
15
  * For initialized instances without detector in services, manually create a detector instance
16
16
  * For wrapper instances, access the underlying i18next instance's services
17
17
  */
18
- export declare const detectLanguage: (i18nInstance: I18nInstance, _request?: any, detectionOptions?: any) => string | undefined;
18
+ export declare const detectLanguage: (i18nInstance: I18nInstance, _request?: unknown, detectionOptions?: LanguageDetectorOptions) => string | undefined;
19
19
  /**
20
20
  * Cache user language to localStorage/cookie
21
21
  * Uses LanguageDetector's cacheUserLanguage method when available
22
22
  * For wrapper instances, access the underlying i18next instance's services
23
23
  */
24
- export declare const cacheUserLanguage: (i18nInstance: I18nInstance, language: string, detectionOptions?: any) => void;
24
+ export declare const cacheUserLanguage: (i18nInstance: I18nInstance, language: string, detectionOptions?: unknown) => void;
@@ -1,10 +1,10 @@
1
- import type { I18nInstance } from '../instance';
2
- export declare const cacheUserLanguage: (_i18nInstance: I18nInstance, _language: string, _detectionOptions?: any) => void;
1
+ import type { I18nInstance, LanguageDetectorOptions } from '../instance';
2
+ export declare const cacheUserLanguage: (_i18nInstance: I18nInstance, _language: string, _detectionOptions?: unknown) => void;
3
3
  /**
4
4
  * Read language directly from storage (localStorage/cookie)
5
5
  * Not available in Node.js environment, returns undefined
6
6
  */
7
- export declare const readLanguageFromStorage: (_detectionOptions?: any) => string | undefined;
7
+ export declare const readLanguageFromStorage: (_detectionOptions?: LanguageDetectorOptions) => string | undefined;
8
8
  /**
9
9
  * Register LanguageDetector plugin to i18n instance
10
10
  * Must be called before init() to properly register the detector
@@ -14,4 +14,4 @@ export declare const useI18nextLanguageDetector: (i18nInstance: I18nInstance) =>
14
14
  * Detect language using i18next-http-middleware LanguageDetector
15
15
  * For initialized instances without detector in services, manually create a detector instance
16
16
  */
17
- export declare const detectLanguage: (i18nInstance: I18nInstance, request?: any, detectionOptions?: any) => string | undefined;
17
+ export declare const detectLanguage: (i18nInstance: I18nInstance, request?: unknown, detectionOptions?: LanguageDetectorOptions) => string | undefined;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Priority 2: Detect language from URL path
3
+ * Only returns a language if the path explicitly contains a language prefix
4
+ */
5
+ export declare const detectLanguageFromPathPriority: (pathname: string, languages: string[], localePathRedirect: boolean) => string | undefined;
@@ -0,0 +1,10 @@
1
+ import { type I18nInstance } from '../instance';
2
+ import type { LanguageDetectionOptions, LanguageDetectionResult } from './types';
3
+ /**
4
+ * Detect language with priority:
5
+ * Priority 1: Path detection
6
+ * Priority 2: SSR data (try window._SSR_DATA first, works for both SSR and CSR)
7
+ * Priority 3: i18next detector (reads from cookie/localStorage)
8
+ * Priority 4: User config language or fallback
9
+ */
10
+ export declare const detectLanguageWithPriority: (i18nInstance: I18nInstance, options: LanguageDetectionOptions) => Promise<LanguageDetectionResult>;
@@ -0,0 +1,9 @@
1
+ import { type TRuntimeContext } from '@modern-js/runtime';
2
+ export declare function exportServerLngToWindow(context: TRuntimeContext, lng: string): void;
3
+ export declare const getLanguageFromSSRData: (window: Window) => string | undefined;
4
+ /**
5
+ * Priority 1: Detect language from SSR data
6
+ * Try to get language from window._SSR_DATA first (both SSR and CSR projects)
7
+ * Returns undefined if SSR data is not available or invalid
8
+ */
9
+ export declare const detectLanguageFromSSR: (languages: string[]) => string | undefined;
@@ -0,0 +1,32 @@
1
+ import type { BackendOptions, I18nInitOptions, LanguageDetectorOptions } from '../instance';
2
+ export interface LanguageDetectionSsrContext {
3
+ request?: unknown;
4
+ }
5
+ export interface BaseLanguageDetectionOptions {
6
+ languages: string[];
7
+ fallbackLanguage: string;
8
+ localePathRedirect: boolean;
9
+ i18nextDetector: boolean;
10
+ detection?: LanguageDetectorOptions;
11
+ userInitOptions?: I18nInitOptions;
12
+ mergedBackend?: BackendOptions;
13
+ }
14
+ export interface LanguageDetectionOptions extends BaseLanguageDetectionOptions {
15
+ pathname: string;
16
+ ssrContext?: LanguageDetectionSsrContext;
17
+ }
18
+ export interface LanguageDetectionResult {
19
+ detectedLanguage?: string;
20
+ finalLanguage: string;
21
+ }
22
+ /**
23
+ * Options for building i18n init options
24
+ */
25
+ export interface BuildInitOptionsParams {
26
+ finalLanguage: string;
27
+ fallbackLanguage: string;
28
+ languages: string[];
29
+ userInitOptions?: I18nInitOptions;
30
+ mergedDetection?: LanguageDetectorOptions;
31
+ mergeBackend?: BackendOptions;
32
+ }
@@ -1,46 +1,48 @@
1
1
  import type { BaseBackendOptions } from '../../shared/type';
2
- export interface I18nResourceStore {
2
+ interface I18nResourceStore {
3
3
  data?: {
4
4
  [language: string]: {
5
- [namespace: string]: string | {
6
- [key: string]: any;
7
- };
5
+ [namespace: string]: ResourceValue;
8
6
  };
9
7
  };
10
8
  addResourceBundle?: (language: string, namespace: string, resources: Record<string, string>, deep?: boolean, overwrite?: boolean) => void;
11
9
  }
12
- export declare function isI18nWrapperInstance(obj: any): boolean;
13
- export declare function getI18nWrapperI18nextInstance(wrapperInstance: any): any;
14
- export declare function getActualI18nextInstance(instance: I18nInstance | any): any;
10
+ type I18nWrapperInstance = I18nInstance & {
11
+ i18nInstance: {
12
+ instance: I18nInstance;
13
+ };
14
+ };
15
+ export declare function isI18nWrapperInstance(obj: unknown): obj is I18nWrapperInstance;
16
+ export declare function getActualI18nextInstance(instance: I18nInstance): I18nInstance;
15
17
  export interface I18nInstance {
16
18
  language: string;
17
19
  isInitialized?: boolean;
18
20
  init: {
19
- (callback?: (error: any, t: any) => void): Promise<any>;
20
- (options: I18nInitOptions, callback?: (error: any, t: any) => void): Promise<any>;
21
+ (callback?: (error: unknown, t: unknown) => void): Promise<unknown>;
22
+ (options: I18nInitOptions, callback?: (error: unknown, t: unknown) => void): Promise<unknown>;
21
23
  };
22
- changeLanguage?: (lng?: string, callback?: (error: any, t: any) => void) => Promise<any>;
24
+ changeLanguage?: (lng?: string, callback?: (error: unknown, t: unknown) => void) => Promise<unknown>;
23
25
  setLang?: (lang: string) => void | Promise<void>;
24
- use: (plugin: any) => void;
26
+ use: (plugin: unknown) => void;
25
27
  createInstance?: (options?: I18nInitOptions) => I18nInstance;
26
28
  cloneInstance?: () => I18nInstance;
27
29
  store?: I18nResourceStore;
28
- emit?: (event: string, ...args: any[]) => void;
30
+ emit?: (event: string, ...args: unknown[]) => void;
29
31
  reloadResources?: (language?: string, namespace?: string) => Promise<void>;
30
32
  services?: {
31
33
  languageDetector?: {
32
- detect: (request?: any, options?: any) => string | string[] | undefined;
33
- [key: string]: any;
34
+ detect: (request?: unknown, options?: unknown) => string | string[] | undefined;
35
+ [key: string]: unknown;
34
36
  };
35
37
  resourceStore?: I18nResourceStore;
36
- backend?: any;
37
- [key: string]: any;
38
+ backend?: unknown;
39
+ [key: string]: unknown;
38
40
  };
39
41
  options?: {
40
42
  backend?: BackendOptions;
41
- [key: string]: any;
43
+ [key: string]: unknown;
42
44
  };
43
- [key: string]: any;
45
+ [key: string]: unknown;
44
46
  }
45
47
  type LanguageDetectorOrder = string[];
46
48
  type LanguageDetectorCaches = boolean | string[];
@@ -57,11 +59,11 @@ export interface LanguageDetectorOptions {
57
59
  lookupHeader?: string;
58
60
  }
59
61
  export interface BackendOptions extends Omit<BaseBackendOptions, 'enabled'> {
60
- parse?: (data: string) => any;
61
- stringify?: (data: any) => string;
62
+ parse?: (data: string) => unknown;
63
+ stringify?: (data: unknown) => string;
62
64
  [key: string]: any;
63
65
  }
64
- export type ResourceValue = string | {
66
+ type ResourceValue = string | {
65
67
  [key: string]: ResourceValue;
66
68
  };
67
69
  export interface Resources {
@@ -81,14 +83,14 @@ export type I18nInitOptions = {
81
83
  defaultNS?: string | string[];
82
84
  interpolation?: {
83
85
  escapeValue?: boolean;
84
- [key: string]: any;
86
+ [key: string]: unknown;
85
87
  };
86
88
  react?: {
87
89
  useSuspense?: boolean;
88
- [key: string]: any;
90
+ [key: string]: unknown;
89
91
  };
90
92
  };
91
- export declare function isI18nInstance(obj: any): obj is I18nInstance;
92
- export declare function getI18nextInstanceForProvider(instance: I18nInstance | any): any;
93
- export declare function getI18nInstance(userInstance?: I18nInstance | any): Promise<I18nInstance>;
93
+ export declare function isI18nInstance(obj: unknown): obj is I18nInstance;
94
+ export declare function getI18nextInstanceForProvider(instance: I18nInstance): I18nInstance;
95
+ export declare function getI18nInstance(userInstance?: unknown): Promise<I18nInstance>;
94
96
  export {};
@@ -1,7 +1,2 @@
1
- import type React from 'react';
2
- interface ReactI18nextIntegration {
3
- I18nextProvider: React.ComponentType<any> | null;
4
- initReactI18next: any | null;
5
- }
1
+ import type { ReactI18nextIntegration } from '../reactI18next';
6
2
  export declare function getReactI18nextIntegration(): Promise<ReactI18nextIntegration>;
7
- export {};
@@ -1,10 +1,18 @@
1
1
  import type { BaseBackendOptions } from '../../shared/type';
2
2
  import type { I18nInitOptions, I18nInstance } from './instance';
3
- export declare function assertI18nInstance(obj: any): asserts obj is I18nInstance;
3
+ type MergedBackendOptions = NonNullable<I18nInitOptions['backend']> & {
4
+ _useChainedBackend?: boolean;
5
+ _chainedBackendConfig?: {
6
+ backendOptions: Array<Record<string, unknown>>;
7
+ };
8
+ backends?: unknown[];
9
+ backendOptions?: unknown;
10
+ };
11
+ export declare function assertI18nInstance(obj: unknown): asserts obj is I18nInstance;
4
12
  /**
5
13
  * Build initialization options for i18n instance
6
14
  */
7
- export declare const buildInitOptions: (finalLanguage: string, fallbackLanguage: string, languages: string[], mergedDetection: any, mergedBackend: any, userInitOptions?: I18nInitOptions, useSuspense?: boolean, i18nInstance?: I18nInstance) => Promise<I18nInitOptions>;
15
+ export declare const buildInitOptions: (finalLanguage: string, fallbackLanguage: string, languages: string[], mergedDetection: I18nInitOptions['detection'], mergedBackend: MergedBackendOptions | undefined, userInitOptions?: I18nInitOptions, useSuspense?: boolean, i18nInstance?: I18nInstance) => Promise<I18nInitOptions>;
8
16
  /**
9
17
  * Ensure i18n instance language matches the final detected language
10
18
  */
@@ -17,13 +25,14 @@ export declare const ensureLanguageMatch: (i18nInstance: I18nInstance, finalLang
17
25
  * @param options - Optional configuration
18
26
  */
19
27
  export declare const changeI18nLanguage: (i18nInstance: I18nInstance, newLang: string, options?: {
20
- detectionOptions?: any;
28
+ detectionOptions?: I18nInitOptions['detection'];
21
29
  }) => Promise<void>;
22
30
  /**
23
31
  * Initialize i18n instance if not already initialized
24
32
  */
25
- export declare const initializeI18nInstance: (i18nInstance: I18nInstance, finalLanguage: string, fallbackLanguage: string, languages: string[], mergedDetection: any, mergedBackend: any, userInitOptions?: I18nInitOptions, useSuspense?: boolean) => Promise<void>;
33
+ export declare const initializeI18nInstance: (i18nInstance: I18nInstance, finalLanguage: string, fallbackLanguage: string, languages: string[], mergedDetection: I18nInitOptions['detection'], mergedBackend: MergedBackendOptions | undefined, userInitOptions?: I18nInitOptions, useSuspense?: boolean) => Promise<void>;
26
34
  /**
27
35
  * Setup cloned instance for SSR with backend support
28
36
  */
29
- export declare const setupClonedInstance: (i18nInstance: I18nInstance, finalLanguage: string, fallbackLanguage: string, languages: string[], backendEnabled: boolean, backend: BaseBackendOptions | undefined, i18nextDetector: boolean, detection: any, localePathRedirect: boolean, userInitOptions: I18nInitOptions | undefined) => Promise<void>;
37
+ export declare const setupClonedInstance: (i18nInstance: I18nInstance, finalLanguage: string, fallbackLanguage: string, languages: string[], backendEnabled: boolean, backend: BaseBackendOptions | undefined, i18nextDetector: boolean, detection: I18nInitOptions['detection'], localePathRedirect: boolean, userInitOptions: I18nInitOptions | undefined) => Promise<void>;
38
+ export {};
@@ -0,0 +1,17 @@
1
+ export declare const warnOnce: (key: string, message: string) => void;
2
+ export type LinkParams = Record<string, string | number | undefined>;
3
+ type NormalizedSearchValue = string | string[];
4
+ /**
5
+ * Interpolate `$param`, `:param`, optional (`{-$param}` / `:param?`) and splat
6
+ * (`$` / `*`) segments with concrete values before localization, so
7
+ * pattern-mapped slugs localize correctly.
8
+ */
9
+ export declare const interpolateRouteParams: (pathname: string, params?: LinkParams) => string;
10
+ export declare const normalizeSearch: (search: string | Record<string, unknown> | undefined, searchFromTo: string) => {
11
+ searchString: string;
12
+ searchObject: Record<string, NormalizedSearchValue> | undefined;
13
+ };
14
+ type ActivePropsResult<TActiveProps extends Record<string, unknown>> = Record<string, unknown> & Partial<TActiveProps>;
15
+ export declare const splitActiveProps: <TActiveProps extends Record<string, unknown>>(active: boolean, activeProps?: TActiveProps) => ActivePropsResult<TActiveProps>;
16
+ export declare const mergeClassNames: (...values: Array<unknown>) => string | undefined;
17
+ export {};
@@ -0,0 +1,32 @@
1
+ import type { TInternalRuntimeContext } from '@modern-js/runtime/internal';
2
+ import type { BaseBackendOptions, BaseLocaleDetectionOptions } from '../shared/type';
3
+ import type { I18nInitOptions, I18nInstance } from './i18n';
4
+ import type { ReactI18nextIntegration } from './reactI18next';
5
+ interface RuntimeConfigWithI18n {
6
+ i18n?: {
7
+ initOptions?: I18nInitOptions;
8
+ };
9
+ }
10
+ interface I18nRuntimeApi {
11
+ getRuntimeConfig: () => RuntimeConfigWithI18n;
12
+ }
13
+ export interface RuntimeContextWithI18n extends TInternalRuntimeContext {
14
+ i18nInstance?: I18nInstance;
15
+ changeLanguage?: (lang: string) => Promise<void>;
16
+ }
17
+ interface SetupI18nBeforeRenderOptions {
18
+ api: I18nRuntimeApi;
19
+ userI18nInstance?: I18nInstance;
20
+ initOptions?: I18nInitOptions;
21
+ backend?: BaseBackendOptions;
22
+ backendEnabled: boolean;
23
+ i18nextDetector: boolean;
24
+ detection?: BaseLocaleDetectionOptions['detection'];
25
+ localePathRedirect: boolean;
26
+ languages: string[];
27
+ fallbackLanguage: string;
28
+ resolveReactI18nextIntegration: () => Promise<ReactI18nextIntegration | null>;
29
+ setI18nextProvider: (provider: ReactI18nextIntegration['I18nextProvider']) => void;
30
+ }
31
+ export declare function setupI18nBeforeRender(context: RuntimeContextWithI18n, options: SetupI18nBeforeRenderOptions): Promise<I18nInstance>;
32
+ export {};
@@ -0,0 +1,16 @@
1
+ import type React from 'react';
2
+ import type { BaseLocaleDetectionOptions } from '../shared/type';
3
+ import type { I18nInstance } from './i18n';
4
+ interface I18nRootWrapperOptions {
5
+ entryName?: string;
6
+ htmlLangAttr: boolean;
7
+ localePathRedirect: boolean;
8
+ languages: string[];
9
+ fallbackLanguage: string;
10
+ ignoreRedirectRoutes?: BaseLocaleDetectionOptions['ignoreRedirectRoutes'];
11
+ localisedUrls?: BaseLocaleDetectionOptions['localisedUrls'];
12
+ getLatestI18nInstance: () => I18nInstance | undefined;
13
+ getI18nextProvider: () => React.ComponentType<any> | null | undefined;
14
+ }
15
+ export declare const createI18nRootWrapper: (options: I18nRootWrapperOptions) => (App: React.ComponentType<any>) => (props: Record<string, unknown>) => React.JSX.Element;
16
+ export {};
@@ -0,0 +1,7 @@
1
+ import type React from 'react';
2
+ export interface ReactI18nextIntegration {
3
+ I18nextProvider: React.ComponentType<any> | null;
4
+ initReactI18next: any | null;
5
+ }
6
+ export type LoadReactI18nextIntegration = () => Promise<ReactI18nextIntegration | null>;
7
+ export declare const resolveReactI18nextIntegration: (reactI18next: boolean, loadReactI18nextIntegration?: LoadReactI18nextIntegration) => Promise<ReactI18nextIntegration | null>;
@@ -1,21 +1,21 @@
1
1
  import type React from 'react';
2
- export type I18nRouterFramework = 'react-router' | 'tanstack' | string;
3
- export interface I18nRouterLocation {
2
+ type I18nRouterFramework = 'react-router' | 'tanstack' | string;
3
+ interface I18nRouterLocation {
4
4
  pathname: string;
5
5
  search: string;
6
6
  hash: string;
7
7
  }
8
- export interface I18nRouterNavigateOptions {
8
+ interface I18nRouterNavigateOptions {
9
9
  replace?: boolean;
10
10
  state?: unknown;
11
11
  }
12
- export type I18nRouterNavigate = (href: string, options?: I18nRouterNavigateOptions) => void | Promise<void>;
13
- export type I18nRouterLink = React.ComponentType<{
12
+ type I18nRouterNavigate = (href: string, options?: I18nRouterNavigateOptions) => void | Promise<void>;
13
+ type I18nRouterLink = React.ComponentType<{
14
14
  to: string;
15
15
  children?: React.ReactNode;
16
16
  [key: string]: unknown;
17
17
  }>;
18
- export interface I18nRouterAdapter {
18
+ interface I18nRouterAdapter {
19
19
  framework?: I18nRouterFramework;
20
20
  hasRouter: boolean;
21
21
  location: I18nRouterLocation | null;
@@ -24,3 +24,4 @@ export interface I18nRouterAdapter {
24
24
  params: Record<string, string>;
25
25
  }
26
26
  export declare const useI18nRouterAdapter: () => I18nRouterAdapter;
27
+ export {};
@@ -1,6 +1,11 @@
1
- import { type TInternalRuntimeContext } from '@modern-js/runtime/context';
2
1
  import type { LocalisedUrlsOption } from '../shared/localisedUrls';
3
- export declare const getPathname: (context: TInternalRuntimeContext) => string;
2
+ export declare const getPathname: (context: {
3
+ ssrContext?: {
4
+ request?: {
5
+ pathname?: string;
6
+ };
7
+ };
8
+ }) => string;
4
9
  export declare const getEntryPath: () => string;
5
10
  /**
6
11
  * Helper function to get language from current pathname
@@ -0,0 +1,7 @@
1
+ type ApiPrefixInput = string | string[] | undefined;
2
+ export declare const collectApiPrefixes: (routes: Array<{
3
+ isApi?: boolean;
4
+ urlPath?: string;
5
+ }>, bffPrefix?: ApiPrefixInput) => string[];
6
+ export declare const matchesApiPrefix: (pathname: string, apiPrefixes: string[]) => boolean;
7
+ export {};
@@ -0,0 +1,21 @@
1
+ import type { LanguageDetectorOptions } from '../runtime/i18n/instance';
2
+ /**
3
+ * Convert i18next detection options to hono languageDetector options
4
+ */
5
+ export declare const convertToHonoLanguageDetectorOptions: (languages: string[], fallbackLanguage: string, detectionOptions?: LanguageDetectorOptions) => {
6
+ supportedLanguages: string[];
7
+ fallbackLanguage: string;
8
+ order: ("cookie" | "header" | "path" | "querystring")[];
9
+ lookupQueryString: string;
10
+ lookupCookie: string;
11
+ lookupFromHeaderKey: string;
12
+ caches?: false | ["cookie"] | undefined;
13
+ cookieOptions?: {
14
+ maxAge: number;
15
+ sameSite: "Lax" | "None" | "Strict";
16
+ secure: boolean;
17
+ httpOnly: boolean;
18
+ domain?: string | undefined;
19
+ } | undefined;
20
+ ignoreCase: boolean;
21
+ };
@@ -1,14 +1,9 @@
1
1
  import type { ServerPlugin } from '@modern-js/server-runtime';
2
2
  import type { LocaleDetectionOptions } from '../shared/type';
3
+ export { collectApiPrefixes, matchesApiPrefix } from './apiPrefix.js';
3
4
  export interface I18nPluginOptions {
4
5
  localeDetection: LocaleDetectionOptions;
5
6
  staticRoutePrefixes: string[];
6
7
  }
7
- type ApiPrefixInput = string | string[] | undefined;
8
- export declare const collectApiPrefixes: (routes: Array<{
9
- isApi?: boolean;
10
- urlPath?: string;
11
- }>, bffPrefix?: ApiPrefixInput) => string[];
12
- export declare const matchesApiPrefix: (pathname: string, apiPrefixes: string[]) => boolean;
13
8
  export declare const i18nServerPlugin: (options: I18nPluginOptions) => ServerPlugin;
14
9
  export default i18nServerPlugin;
@@ -0,0 +1,22 @@
1
+ import type { LocaleDetectionOptions } from '../shared/type';
2
+ interface LocaleRedirectRequest {
3
+ url: string;
4
+ header: () => {
5
+ host?: string;
6
+ };
7
+ }
8
+ /**
9
+ * Check if pathname should ignore automatic locale redirect.
10
+ */
11
+ export declare const shouldIgnoreRedirect: (pathname: string, urlPath: string, ignoreRedirectRoutes?: string[] | ((pathname: string) => boolean)) => boolean;
12
+ /**
13
+ * Check if pathname is a static or federation resource request.
14
+ *
15
+ * This includes configured staticRoutePrefixes, the shared default skip policy
16
+ * from ADR-0002, and language-prefixed variants such as /en/static/app.js.
17
+ */
18
+ export declare const isStaticResourceRequest: (pathname: string, staticRoutePrefixes: string[], languages?: string[]) => boolean;
19
+ export declare const getLanguageFromPath: (req: LocaleRedirectRequest, urlPath: string, languages: string[]) => string | null;
20
+ export declare const buildLocalizedUrl: (req: LocaleRedirectRequest, urlPath: string, language: string, languages: string[], localisedUrls?: LocaleDetectionOptions['localisedUrls']) => string;
21
+ export declare const createLocaleRedirectResponse: (location: string) => Response;
22
+ export {};
@@ -1,11 +1 @@
1
- import type { LanguageDetectorOptions } from '../runtime/i18n/instance';
2
- /**
3
- * Detect language from request using the same detection logic as i18next
4
- * This ensures consistency between server-side and client-side detection
5
- */
6
- export declare function detectLanguageFromRequest(req: {
7
- url: string;
8
- headers: {
9
- get: (name: string) => string | null;
10
- } | Headers;
11
- }, languages: string[], detectionOptions?: LanguageDetectorOptions): string | null;
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { LocalisedUrlsOption, ResolvedLocalisedUrlsConfig } from './types';
2
+ /**
3
+ * Localised URLs are strictly opt-in: only an explicit, non-empty map enables
4
+ * route expansion and validation. `true`, `false`, an empty map and absence
5
+ * all resolve to disabled, so upstream-style configs (`localePathRedirect` +
6
+ * `languages` without a map) keep plain locale-prefix behavior instead of
7
+ * failing the build for every route missing from a map they never wrote.
8
+ */
9
+ export declare const resolveLocalisedUrlsConfig: (option: LocalisedUrlsOption | undefined) => ResolvedLocalisedUrlsConfig;
@@ -0,0 +1,9 @@
1
+ export { resolveLocalisedUrlsConfig } from './config';
2
+ export { normalisePathname, normalisePathPattern } from './normalise';
3
+ export { canonicalTargetPathname, localiseTargetPathname, stripLanguagePrefix, } from './pathname';
4
+ export { buildPathFromPattern, matchPathPattern } from './patterns';
5
+ export type { LocaleRedirectSkipRule } from './redirect';
6
+ export { DEFAULT_LOCALE_REDIRECT_SKIP_RULES, isDefaultLocaleRedirectSkipPath, matchesPathPrefix, shouldSkipLocaleRedirect, } from './redirect';
7
+ export { resolveCanonicalLocalisedPath, resolveLocalisedPath } from './resolve';
8
+ export { applyLocalisedUrlsToRoutes, validateLocalisedUrls } from './routes';
9
+ export type { LocalisedRoute, LocalisedUrlPathMap, LocalisedUrlsMap, LocalisedUrlsOption, ResolvedLocalisedUrlsConfig, } from './types';
@@ -0,0 +1,10 @@
1
+ export declare const normalisePathPattern: (path: string) => string;
2
+ /**
3
+ * Normalise a concrete request pathname: slash cleanup only. Unlike
4
+ * {@link normalisePathPattern} it must not rewrite literal `[x]` segments to
5
+ * `:x` params — pathnames are values, not patterns.
6
+ */
7
+ export declare const normalisePathname: (pathname: string) => string;
8
+ export declare const normaliseRoutePath: (path: string) => string;
9
+ export declare const stripLeadingLocaleParam: (path?: string) => string | undefined;
10
+ export declare const getLeadingLocaleParam: (path?: string) => string | null;
@@ -0,0 +1,4 @@
1
+ import type { LocalisedUrlsOption } from './types';
2
+ export declare const stripLanguagePrefix: (pathname: string, languages: string[]) => string;
3
+ export declare const localiseTargetPathname: (pathname: string, language: string, languages: string[], localisedUrls?: LocalisedUrlsOption) => string;
4
+ export declare const canonicalTargetPathname: (pathname: string, languages: string[], localisedUrls?: LocalisedUrlsOption) => string;
@@ -0,0 +1,5 @@
1
+ export declare const sortPatternsBySpecificity: <T extends {
2
+ pattern: string;
3
+ }>(patterns: T[]) => T[];
4
+ export declare const matchPathPattern: (pathname: string, pattern: string) => Record<string, string> | null;
5
+ export declare const buildPathFromPattern: (pattern: string, params: Record<string, string>) => string;
@@ -0,0 +1,11 @@
1
+ export type LocaleRedirectSkipRule = {
2
+ type: 'exact';
3
+ path: string;
4
+ } | {
5
+ type: 'prefix';
6
+ path: string;
7
+ };
8
+ export declare const DEFAULT_LOCALE_REDIRECT_SKIP_RULES: readonly LocaleRedirectSkipRule[];
9
+ export declare const matchesPathPrefix: (pathname: string, prefix: string) => boolean;
10
+ export declare const isDefaultLocaleRedirectSkipPath: (pathname: string, languages?: string[]) => boolean;
11
+ export declare const shouldSkipLocaleRedirect: (pathname: string, languages?: string[], ignoreRedirectRoutes?: string[] | ((pathname: string) => boolean)) => boolean;
@@ -0,0 +1,7 @@
1
+ import type { LocalisedUrlsMap } from './types';
2
+ export declare const resolveLocalisedPath: (pathname: string, targetLanguage: string, languages: string[], localisedUrls: LocalisedUrlsMap) => string;
3
+ /**
4
+ * Reverse-map language-specific pathnames back to language-agnostic
5
+ * LocalisedUrlsMap keys.
6
+ */
7
+ export declare const resolveCanonicalLocalisedPath: (pathname: string, languages: string[], localisedUrls: LocalisedUrlsMap) => string;
@@ -0,0 +1,3 @@
1
+ import type { LocalisedRoute, LocalisedUrlsMap } from './types';
2
+ export declare const validateLocalisedUrls: (routes: LocalisedRoute[], languages: string[], localisedUrls: LocalisedUrlsMap) => void;
3
+ export declare const applyLocalisedUrlsToRoutes: (routes: LocalisedRoute[], languages: string[], localisedUrls: LocalisedUrlsMap) => LocalisedRoute[];