@astroscope/i18n 0.1.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.
Files changed (194) hide show
  1. package/README.md +262 -0
  2. package/dist/babel-plugin-FUTQRKLT.js +121 -0
  3. package/dist/babel-plugin-K2K4ZPM5.js +118 -0
  4. package/dist/chunk-22ZZFFC2.js +159 -0
  5. package/dist/chunk-2PSXD3JJ.js +144 -0
  6. package/dist/chunk-3VI62RLT.js +176 -0
  7. package/dist/chunk-4A5BKHFN.js +16 -0
  8. package/dist/chunk-4DAQPWXI.js +36 -0
  9. package/dist/chunk-4OGX6AF5.js +10 -0
  10. package/dist/chunk-4PHYKXO3.js +227 -0
  11. package/dist/chunk-4UBFISFY.js +376 -0
  12. package/dist/chunk-5DERF6DV.js +266 -0
  13. package/dist/chunk-5KGNHFTC.js +344 -0
  14. package/dist/chunk-5PP4D2VK.js +23 -0
  15. package/dist/chunk-6BW3PN23.js +14 -0
  16. package/dist/chunk-6ESQ4JQI.js +263 -0
  17. package/dist/chunk-A7MPXMOP.js +202 -0
  18. package/dist/chunk-AWZ2SQDW.js +149 -0
  19. package/dist/chunk-AYY2YIBQ.js +52 -0
  20. package/dist/chunk-BMNEJFTD.js +56 -0
  21. package/dist/chunk-BSXQGEUK.js +16 -0
  22. package/dist/chunk-BSYTJFGF.js +21 -0
  23. package/dist/chunk-BVPXEGTT.js +12 -0
  24. package/dist/chunk-C4DJYWF6.js +193 -0
  25. package/dist/chunk-C5EJYE2P.js +245 -0
  26. package/dist/chunk-CLNOQHMS.js +254 -0
  27. package/dist/chunk-E5MCIRSU.js +144 -0
  28. package/dist/chunk-E7ZJS7WX.js +162 -0
  29. package/dist/chunk-EMM6LRO2.js +8 -0
  30. package/dist/chunk-ESFGCYYH.js +24 -0
  31. package/dist/chunk-FAKBSLNW.js +24 -0
  32. package/dist/chunk-FHBVI3TL.js +372 -0
  33. package/dist/chunk-FI5KZ5IO.js +17 -0
  34. package/dist/chunk-H5R6YMOL.js +233 -0
  35. package/dist/chunk-H62K3FGA.js +236 -0
  36. package/dist/chunk-HDG2R6XT.js +211 -0
  37. package/dist/chunk-HGXU5QAK.js +344 -0
  38. package/dist/chunk-HHRMR3TM.js +17 -0
  39. package/dist/chunk-HS4HVBAD.js +127 -0
  40. package/dist/chunk-IPJWKKHJ.js +324 -0
  41. package/dist/chunk-ITTL4V7J.js +24 -0
  42. package/dist/chunk-IWUBCMOK.js +128 -0
  43. package/dist/chunk-JJBBY2GR.js +14 -0
  44. package/dist/chunk-JJEDOJBR.js +193 -0
  45. package/dist/chunk-JTUKXNIJ.js +23 -0
  46. package/dist/chunk-K7YULG4A.js +14 -0
  47. package/dist/chunk-KNDYKTHE.js +31 -0
  48. package/dist/chunk-KNONI6DP.js +89 -0
  49. package/dist/chunk-LMTEO22Y.js +17 -0
  50. package/dist/chunk-LRLZEX4D.js +147 -0
  51. package/dist/chunk-MFKPLUAN.js +241 -0
  52. package/dist/chunk-MIWXQOO3.js +316 -0
  53. package/dist/chunk-MJRTAWPR.js +261 -0
  54. package/dist/chunk-MZEPQCXX.js +249 -0
  55. package/dist/chunk-NHHTSFA7.js +237 -0
  56. package/dist/chunk-NTTXM7AG.js +23 -0
  57. package/dist/chunk-NZFAVJXR.js +192 -0
  58. package/dist/chunk-OFNFSDW3.js +13 -0
  59. package/dist/chunk-PG3XDNGF.js +227 -0
  60. package/dist/chunk-PVEVTPNK.js +139 -0
  61. package/dist/chunk-QAO4BXS4.js +244 -0
  62. package/dist/chunk-QCTULQQK.js +34 -0
  63. package/dist/chunk-QFAAGCP5.js +177 -0
  64. package/dist/chunk-QKND2KCA.js +163 -0
  65. package/dist/chunk-QZEGY6RJ.js +151 -0
  66. package/dist/chunk-RAE2L6FT.js +193 -0
  67. package/dist/chunk-S3ABJBU3.js +255 -0
  68. package/dist/chunk-SVDVCPCV.js +236 -0
  69. package/dist/chunk-T35ZUWTL.js +153 -0
  70. package/dist/chunk-T6WV5DW6.js +156 -0
  71. package/dist/chunk-TGUXVDA3.js +82 -0
  72. package/dist/chunk-TYMO7K3A.js +173 -0
  73. package/dist/chunk-V4RBFLQL.js +23 -0
  74. package/dist/chunk-V4XWJXXZ.js +23 -0
  75. package/dist/chunk-VQCY3OKK.js +258 -0
  76. package/dist/chunk-WLGOJPDJ.js +15 -0
  77. package/dist/chunk-WUEPDJIL.js +259 -0
  78. package/dist/chunk-X3L7WZLY.js +254 -0
  79. package/dist/chunk-XDD62ZM3.js +255 -0
  80. package/dist/chunk-XFXXEDRD.js +36 -0
  81. package/dist/chunk-XKYOR5UK.js +8 -0
  82. package/dist/chunk-Y26535SI.js +239 -0
  83. package/dist/chunk-Y3PQX5TX.js +152 -0
  84. package/dist/chunk-Y4BE2V6F.js +347 -0
  85. package/dist/chunk-Z4IZYDIA.js +24 -0
  86. package/dist/chunk-Z52G4CYY.js +14 -0
  87. package/dist/chunk-ZGLUYWVM.js +128 -0
  88. package/dist/client/directives/idle.d.ts +9 -0
  89. package/dist/client/directives/idle.js +15 -0
  90. package/dist/client/directives/load.d.ts +9 -0
  91. package/dist/client/directives/load.js +15 -0
  92. package/dist/client/directives/media.d.ts +9 -0
  93. package/dist/client/directives/media.js +15 -0
  94. package/dist/client/directives/only.d.ts +9 -0
  95. package/dist/client/directives/only.js +15 -0
  96. package/dist/client/directives/utils.d.ts +10 -0
  97. package/dist/client/directives/utils.js +7 -0
  98. package/dist/client/directives/visible.d.ts +9 -0
  99. package/dist/client/directives/visible.js +15 -0
  100. package/dist/client/import-with-i18n.d.ts +16 -0
  101. package/dist/client/import-with-i18n.js +8 -0
  102. package/dist/client/t.d.ts +20 -0
  103. package/dist/client/t.js +37 -0
  104. package/dist/client-directives/idle.d.ts +9 -0
  105. package/dist/client-directives/idle.js +15 -0
  106. package/dist/client-directives/load.d.ts +9 -0
  107. package/dist/client-directives/load.js +15 -0
  108. package/dist/client-directives/media.d.ts +9 -0
  109. package/dist/client-directives/media.js +15 -0
  110. package/dist/client-directives/only.d.ts +9 -0
  111. package/dist/client-directives/only.js +15 -0
  112. package/dist/client-directives/utils.d.ts +9 -0
  113. package/dist/client-directives/utils.js +7 -0
  114. package/dist/client-directives/visible.d.ts +9 -0
  115. package/dist/client-directives/visible.js +15 -0
  116. package/dist/extraction/index.d.ts +34 -0
  117. package/dist/extraction/index.js +9 -0
  118. package/dist/i18n-3cZHoHwP.d.ts +86 -0
  119. package/dist/i18n-BGfrSNM8.d.ts +56 -0
  120. package/dist/i18n-BHU81LMA.d.ts +55 -0
  121. package/dist/i18n-BagoeH4_.d.ts +62 -0
  122. package/dist/i18n-BeL84090.d.ts +77 -0
  123. package/dist/i18n-BeRWDfHi.d.ts +55 -0
  124. package/dist/i18n-Bfs2PVcf.d.ts +79 -0
  125. package/dist/i18n-BrL7p3aN.d.ts +99 -0
  126. package/dist/i18n-CNQNCFU0.d.ts +55 -0
  127. package/dist/i18n-CX_uU8V2.d.ts +80 -0
  128. package/dist/i18n-Cr1QZCwe.d.ts +64 -0
  129. package/dist/i18n-CzTRxGeX.d.ts +80 -0
  130. package/dist/i18n-DUOFiC7g.d.ts +77 -0
  131. package/dist/i18n-DcF47BHS.d.ts +77 -0
  132. package/dist/i18n-DifWvtaO.d.ts +60 -0
  133. package/dist/i18n-DumSqX1t.d.ts +55 -0
  134. package/dist/i18n-fWTJw12h.d.ts +80 -0
  135. package/dist/import-with-i18n.d.ts +23 -0
  136. package/dist/import-with-i18n.js +7 -0
  137. package/dist/index.d.ts +68 -0
  138. package/dist/index.js +151 -0
  139. package/dist/init.d.ts +2 -0
  140. package/dist/init.js +8 -0
  141. package/dist/internal.d.ts +11 -0
  142. package/dist/internal.js +9 -0
  143. package/dist/middleware-entrypoint-C0Drh9E_.d.ts +29 -0
  144. package/dist/middleware-entrypoint-mEl66IUy.d.ts +29 -0
  145. package/dist/middleware-entrypoint.d.ts +5 -0
  146. package/dist/middleware-entrypoint.js +30 -0
  147. package/dist/server/middleware-entrypoint.d.ts +2 -0
  148. package/dist/server/middleware-entrypoint.js +28 -0
  149. package/dist/server/t.d.ts +17 -0
  150. package/dist/server/t.js +59 -0
  151. package/dist/t-BY_C9lZ1.d.ts +30 -0
  152. package/dist/t-CG3yDiEa.d.ts +30 -0
  153. package/dist/t-CHsBfrPr.d.ts +30 -0
  154. package/dist/t-DQpXaDhP.d.ts +30 -0
  155. package/dist/t.client.d.ts +11 -0
  156. package/dist/t.client.js +35 -0
  157. package/dist/t.server.d.ts +22 -0
  158. package/dist/t.server.js +12 -0
  159. package/dist/types-8uKCwFda.d.ts +24 -0
  160. package/dist/types-BC6K-pID.d.ts +110 -0
  161. package/dist/types-BUV7BZML.d.ts +55 -0
  162. package/dist/types-BWGB322F.d.ts +46 -0
  163. package/dist/types-B_-RxW4A.d.ts +7 -0
  164. package/dist/types-BaaSiz9n.d.ts +7 -0
  165. package/dist/types-Bgl2V5xo.d.ts +102 -0
  166. package/dist/types-BwhB6IT4.d.ts +111 -0
  167. package/dist/types-Bzp6KxsI.d.ts +50 -0
  168. package/dist/types-C6rOJFY2.d.ts +24 -0
  169. package/dist/types-C7lD-Woj.d.ts +50 -0
  170. package/dist/types-CLWZeQhD.d.ts +54 -0
  171. package/dist/types-COXt613w.d.ts +19 -0
  172. package/dist/types-CUlkbl9-.d.ts +50 -0
  173. package/dist/types-CVv7GGPj.d.ts +46 -0
  174. package/dist/types-CiIDN2sW.d.ts +64 -0
  175. package/dist/types-Cr86qjYl.d.ts +58 -0
  176. package/dist/types-CxnObiEO.d.ts +7 -0
  177. package/dist/types-D44mFUjA.d.ts +97 -0
  178. package/dist/types-D85m9UTC.d.ts +137 -0
  179. package/dist/types-DWhsmSPP.d.ts +102 -0
  180. package/dist/types-DdprXGJ1.d.ts +46 -0
  181. package/dist/types-DhVJ2ZIo.d.ts +43 -0
  182. package/dist/types-DnbOuM1L.d.ts +7 -0
  183. package/dist/types-DsNK_9sI.d.ts +24 -0
  184. package/dist/types-DvWBr9Xp.d.ts +17 -0
  185. package/dist/types-DwkIalh6.d.ts +24 -0
  186. package/dist/types-OYRgjtE_.d.ts +110 -0
  187. package/dist/types-SV8S05GX.d.ts +7 -0
  188. package/dist/types-TYn9WnxY.d.ts +46 -0
  189. package/dist/types-aXCBbdhq.d.ts +55 -0
  190. package/dist/types-gn4aNKGx.d.ts +54 -0
  191. package/dist/types-nippsMkm.d.ts +54 -0
  192. package/package.json +105 -0
  193. package/src/components/I18nScript.astro +37 -0
  194. package/src/components/index.ts +2 -0
@@ -0,0 +1,20 @@
1
+ import { a as TranslateFunction } from '../types-Bzp6KxsI.js';
2
+ import '../types-B_-RxW4A.js';
3
+
4
+ declare function getLocale(): string;
5
+ /**
6
+ * Client-side translate function
7
+ *
8
+ * Reads from window.__i18n__.translations (injected per-chunk).
9
+ * In production, translations are always loaded before component code runs
10
+ * via the chunk loader injected by the Vite plugin.
11
+ *
12
+ * Call patterns:
13
+ * - Development: t('key', 'fallback') or t('key', 'fallback', values)
14
+ * - Production: t('key') or t('key', undefined, values)
15
+ *
16
+ * Falls back to meta.fallback (dev) or key (prod) when translation is missing.
17
+ */
18
+ declare const t: TranslateFunction;
19
+
20
+ export { getLocale, t };
@@ -0,0 +1,37 @@
1
+ import {
2
+ normalizeMeta
3
+ } from "../chunk-EMM6LRO2.js";
4
+ import {
5
+ compileMessage
6
+ } from "../chunk-KNDYKTHE.js";
7
+
8
+ // src/client/t.ts
9
+ var cache = /* @__PURE__ */ new Map();
10
+ function getLocale() {
11
+ return window.__i18n__.locale;
12
+ }
13
+ var t = ((key, meta, values) => {
14
+ const normalizedMeta = meta ? normalizeMeta(meta) : { fallback: "" };
15
+ const raw = window.__i18n__.translations[key];
16
+ if (!raw) {
17
+ if (normalizedMeta.fallback) {
18
+ let compiled2 = cache.get(`__fallback__${key}`);
19
+ if (!compiled2) {
20
+ compiled2 = compileMessage(window.__i18n__.locale, normalizedMeta.fallback);
21
+ cache.set(`__fallback__${key}`, compiled2);
22
+ }
23
+ return compiled2(values);
24
+ }
25
+ return key;
26
+ }
27
+ let compiled = cache.get(key);
28
+ if (!compiled) {
29
+ compiled = compileMessage(window.__i18n__.locale, raw);
30
+ cache.set(key, compiled);
31
+ }
32
+ return compiled(values);
33
+ });
34
+ export {
35
+ getLocale,
36
+ t
37
+ };
@@ -0,0 +1,9 @@
1
+ import { ClientDirective } from 'astro';
2
+
3
+ /**
4
+ * i18n-aware client:idle directive
5
+ * Loads translations in parallel before delegating to Astro's original idle directive
6
+ */
7
+ declare const idleDirective: ClientDirective;
8
+
9
+ export { idleDirective as default };
@@ -0,0 +1,15 @@
1
+ import {
2
+ loadI18nForChunk
3
+ } from "../chunk-ESFGCYYH.js";
4
+ import "../chunk-FI5KZ5IO.js";
5
+
6
+ // src/client-directives/idle.ts
7
+ import originalIdle from "astro/client/idle.js";
8
+ var idleDirective = async (load, options, el) => {
9
+ await loadI18nForChunk(el);
10
+ return originalIdle(load, options, el);
11
+ };
12
+ var idle_default = idleDirective;
13
+ export {
14
+ idle_default as default
15
+ };
@@ -0,0 +1,9 @@
1
+ import { ClientDirective } from 'astro';
2
+
3
+ /**
4
+ * i18n-aware client:load directive
5
+ * Loads translations in parallel before delegating to Astro's original load directive
6
+ */
7
+ declare const loadDirective: ClientDirective;
8
+
9
+ export { loadDirective as default };
@@ -0,0 +1,15 @@
1
+ import {
2
+ loadI18nForChunk
3
+ } from "../chunk-ESFGCYYH.js";
4
+ import "../chunk-FI5KZ5IO.js";
5
+
6
+ // src/client-directives/load.ts
7
+ import originalLoad from "astro/client/load.js";
8
+ var loadDirective = async (load, options, el) => {
9
+ await loadI18nForChunk(el);
10
+ return originalLoad(load, options, el);
11
+ };
12
+ var load_default = loadDirective;
13
+ export {
14
+ load_default as default
15
+ };
@@ -0,0 +1,9 @@
1
+ import { ClientDirective } from 'astro';
2
+
3
+ /**
4
+ * i18n-aware client:media directive
5
+ * Loads translations in parallel before delegating to Astro's original media directive
6
+ */
7
+ declare const mediaDirective: ClientDirective;
8
+
9
+ export { mediaDirective as default };
@@ -0,0 +1,15 @@
1
+ import {
2
+ loadI18nForChunk
3
+ } from "../chunk-ESFGCYYH.js";
4
+ import "../chunk-FI5KZ5IO.js";
5
+
6
+ // src/client-directives/media.ts
7
+ import originalMedia from "astro/client/media.js";
8
+ var mediaDirective = async (load, options, el) => {
9
+ await loadI18nForChunk(el);
10
+ return originalMedia(load, options, el);
11
+ };
12
+ var media_default = mediaDirective;
13
+ export {
14
+ media_default as default
15
+ };
@@ -0,0 +1,9 @@
1
+ import { ClientDirective } from 'astro';
2
+
3
+ /**
4
+ * i18n-aware client:only directive
5
+ * Loads translations in parallel before delegating to Astro's original only directive
6
+ */
7
+ declare const onlyDirective: ClientDirective;
8
+
9
+ export { onlyDirective as default };
@@ -0,0 +1,15 @@
1
+ import {
2
+ loadI18nForChunk
3
+ } from "../chunk-ESFGCYYH.js";
4
+ import "../chunk-FI5KZ5IO.js";
5
+
6
+ // src/client-directives/only.ts
7
+ import originalOnly from "astro/client/only.js";
8
+ var onlyDirective = async (load, options, el) => {
9
+ await loadI18nForChunk(el);
10
+ return originalOnly(load, options, el);
11
+ };
12
+ var only_default = onlyDirective;
13
+ export {
14
+ only_default as default
15
+ };
@@ -0,0 +1,9 @@
1
+ import '../types-DWhsmSPP.js';
2
+
3
+ /**
4
+ * Load translations for a chunk before hydration
5
+ * Extracts chunk name from astro-island's component-url attribute
6
+ */
7
+ declare function loadI18nForChunk(el: HTMLElement): Promise<void>;
8
+
9
+ export { loadI18nForChunk };
@@ -0,0 +1,7 @@
1
+ import {
2
+ loadI18nForChunk
3
+ } from "../chunk-ESFGCYYH.js";
4
+ import "../chunk-FI5KZ5IO.js";
5
+ export {
6
+ loadI18nForChunk
7
+ };
@@ -0,0 +1,9 @@
1
+ import { ClientDirective } from 'astro';
2
+
3
+ /**
4
+ * i18n-aware client:visible directive
5
+ * Loads translations in parallel before delegating to Astro's original visible directive
6
+ */
7
+ declare const visibleDirective: ClientDirective;
8
+
9
+ export { visibleDirective as default };
@@ -0,0 +1,15 @@
1
+ import {
2
+ loadI18nForChunk
3
+ } from "../chunk-ESFGCYYH.js";
4
+ import "../chunk-FI5KZ5IO.js";
5
+
6
+ // src/client-directives/visible.ts
7
+ import originalVisible from "astro/client/visible.js";
8
+ var visibleDirective = async (load, options, el) => {
9
+ await loadI18nForChunk(el);
10
+ return originalVisible(load, options, el);
11
+ };
12
+ var visible_default = visibleDirective;
13
+ export {
14
+ visible_default as default
15
+ };
@@ -0,0 +1,34 @@
1
+ import { a as ExtractionManifest } from '../types-8uKCwFda.js';
2
+ export { C as ChunkManifest, E as ExtractedKey } from '../types-8uKCwFda.js';
3
+ import { AstroIntegrationLogger } from 'astro';
4
+ import { Plugin } from 'vite';
5
+ import '../types-Bzp6KxsI.js';
6
+
7
+ /**
8
+ * Manifest state management for i18n extraction
9
+ *
10
+ * Separated from vite-plugin to avoid bundling Babel at runtime
11
+ */
12
+
13
+ /**
14
+ * Get the current extraction manifest (for dev mode live access).
15
+ * This bypasses Vite's module caching to return fresh data.
16
+ */
17
+ declare function getManifest(): ExtractionManifest;
18
+
19
+ type I18nVitePluginOptions = {
20
+ logger: AstroIntegrationLogger;
21
+ };
22
+ /**
23
+ * Vite plugin for i18n extraction, chunk mapping, and loader injection
24
+ *
25
+ * This plugin:
26
+ * 1. Extracts all t() calls using Babel AST parsing
27
+ * 2. Strips fallback arguments in production builds
28
+ * 3. Maps translation keys to output chunks
29
+ * 4. Generates a manifest for syncing with translation providers
30
+ * 5. Injects translation loader into chunks that use t()
31
+ */
32
+ declare function i18nVitePlugin(options: I18nVitePluginOptions): Plugin;
33
+
34
+ export { ExtractionManifest, type I18nVitePluginOptions, getManifest, i18nVitePlugin };
@@ -0,0 +1,9 @@
1
+ import {
2
+ getManifest,
3
+ i18nVitePlugin
4
+ } from "../chunk-JJEDOJBR.js";
5
+ import "../chunk-4A5BKHFN.js";
6
+ export {
7
+ getManifest,
8
+ i18nVitePlugin
9
+ };
@@ -0,0 +1,86 @@
1
+ import { a as TranslationMeta, C as CompiledTranslations, R as RawTranslations } from './types-CLWZeQhD.js';
2
+
3
+ /**
4
+ * Extracted metadata for a single translation key
5
+ */
6
+ type ExtractedKey = {
7
+ key: string;
8
+ meta: TranslationMeta;
9
+ file: string;
10
+ line: number;
11
+ };
12
+ /**
13
+ * Chunk-to-keys mapping produced by Vite plugin
14
+ */
15
+ type ChunkManifest = Record<string, string[]>;
16
+ /**
17
+ * Full extraction manifest
18
+ */
19
+ type ExtractionManifest = {
20
+ keys: ExtractedKey[];
21
+ chunks: ChunkManifest;
22
+ };
23
+
24
+ /**
25
+ * Fallback behavior when translation is missing
26
+ */
27
+ type FallbackBehavior = 'key' | 'fallback' | 'throw' | ((key: string, meta?: TranslationMeta | undefined) => string);
28
+ /**
29
+ * Request-scoped i18n context
30
+ */
31
+ type I18nContext = {
32
+ locale: string;
33
+ translations: CompiledTranslations;
34
+ fallback: FallbackBehavior;
35
+ };
36
+
37
+ type I18nConfig = {
38
+ locales: string[];
39
+ defaultLocale?: string | undefined;
40
+ fallback?: FallbackBehavior | undefined;
41
+ };
42
+ type NormalizedConfig = {
43
+ locales: string[];
44
+ defaultLocale: string;
45
+ fallback: FallbackBehavior;
46
+ };
47
+ declare class I18nSingleton {
48
+ private config;
49
+ private rawCache;
50
+ private compiledCache;
51
+ private hashCache;
52
+ private manifest;
53
+ configure(config: I18nConfig): void;
54
+ isConfigured(): boolean;
55
+ getConfig(): NormalizedConfig;
56
+ setTranslations(locale: string, raw: RawTranslations): void;
57
+ getTranslations(locale: string): RawTranslations;
58
+ getCompiledTranslations(locale: string): CompiledTranslations;
59
+ getChunkManifest(): ChunkManifest;
60
+ /**
61
+ * Get extracted translation keys with metadata.
62
+ * Use this to populate your translation provider with keys extracted from the codebase.
63
+ */
64
+ getExtractedKeys(): ExtractedKey[];
65
+ /**
66
+ * Get the full extraction manifest (keys + chunks).
67
+ * In dev mode, keys are available live but chunks are empty.
68
+ * In build mode, both keys and chunk mappings are populated.
69
+ */
70
+ getExtractionManifest(): ExtractionManifest;
71
+ /**
72
+ * Set the extraction manifest (called by middleware entrypoint).
73
+ * @internal
74
+ */
75
+ setManifest(manifest: ExtractionManifest): void;
76
+ getHashes(locale: string): Record<string, string>;
77
+ /**
78
+ * Clear translations for specified locale(s).
79
+ * @param locales - Locale(s) to clear, or all if not specified
80
+ */
81
+ clear(locales?: string | string[] | undefined): void;
82
+ private resolveLocales;
83
+ }
84
+ declare const i18n: I18nSingleton;
85
+
86
+ export { type ExtractedKey as E, type FallbackBehavior as F, type I18nContext as I, type I18nConfig as a, type ExtractionManifest as b, i18n as i };
@@ -0,0 +1,56 @@
1
+ import { a as ExtractionManifest } from './types-8uKCwFda.js';
2
+ import { T as TranslationMeta, C as CompiledTranslations, R as RawTranslations } from './types-Bzp6KxsI.js';
3
+
4
+ /**
5
+ * Fallback behavior when translation is missing
6
+ */
7
+ type FallbackBehavior = 'key' | 'fallback' | 'throw' | ((key: string, meta?: TranslationMeta | undefined) => string);
8
+ /**
9
+ * Request-scoped i18n context
10
+ */
11
+ type I18nContext = {
12
+ locale: string;
13
+ translations: CompiledTranslations;
14
+ fallback: FallbackBehavior;
15
+ };
16
+
17
+ type I18nConfig = {
18
+ locales: string[];
19
+ defaultLocale?: string | undefined;
20
+ fallback?: FallbackBehavior | undefined;
21
+ };
22
+ type NormalizedConfig = {
23
+ locales: string[];
24
+ defaultLocale: string;
25
+ fallback: FallbackBehavior;
26
+ };
27
+ declare class I18nSingleton {
28
+ private config;
29
+ private rawCache;
30
+ private mergedCache;
31
+ private compiledCache;
32
+ private hashCache;
33
+ private manifestGetter;
34
+ configure(config: I18nConfig): Promise<void>;
35
+ isConfigured(): boolean;
36
+ getConfig(): NormalizedConfig;
37
+ setTranslations(locale: string, raw: RawTranslations): void;
38
+ getTranslations(locale: string): RawTranslations;
39
+ getCompiledTranslations(locale: string): CompiledTranslations;
40
+ /**
41
+ * Get the extraction manifest (keys + chunks).
42
+ * - keys: translation keys extracted from codebase with metadata
43
+ * - chunks: mapping of chunk names to their translation keys
44
+ */
45
+ getManifest(): ExtractionManifest;
46
+ getHashes(locale: string): Record<string, string>;
47
+ /**
48
+ * Clear translations for specified locale(s).
49
+ * @param locales - Locale(s) to clear, or all if not specified
50
+ */
51
+ clear(locales?: string | string[] | undefined): void;
52
+ private resolveLocales;
53
+ }
54
+ declare const i18n: I18nSingleton;
55
+
56
+ export { type FallbackBehavior as F, type I18nConfig as I, type I18nContext as a, i18n as i };
@@ -0,0 +1,55 @@
1
+ import { a as ExtractionManifest } from './types-8uKCwFda.js';
2
+ import { T as TranslationMeta, C as CompiledTranslations, R as RawTranslations } from './types-Bzp6KxsI.js';
3
+
4
+ /**
5
+ * Fallback behavior when translation is missing
6
+ */
7
+ type FallbackBehavior = 'key' | 'fallback' | 'throw' | ((key: string, meta?: TranslationMeta | undefined) => string);
8
+ /**
9
+ * Request-scoped i18n context
10
+ */
11
+ type I18nContext = {
12
+ locale: string;
13
+ translations: CompiledTranslations;
14
+ fallback: FallbackBehavior;
15
+ };
16
+
17
+ type I18nConfig = {
18
+ locales: string[];
19
+ defaultLocale?: string | undefined;
20
+ fallback?: FallbackBehavior | undefined;
21
+ };
22
+ type NormalizedConfig = {
23
+ locales: string[];
24
+ defaultLocale: string;
25
+ fallback: FallbackBehavior;
26
+ };
27
+ declare class I18nSingleton {
28
+ private config;
29
+ private rawCache;
30
+ private compiledCache;
31
+ private hashCache;
32
+ private manifestGetter;
33
+ configure(config: I18nConfig): Promise<void>;
34
+ isConfigured(): boolean;
35
+ getConfig(): NormalizedConfig;
36
+ setTranslations(locale: string, raw: RawTranslations): void;
37
+ getTranslations(locale: string): RawTranslations;
38
+ getCompiledTranslations(locale: string): CompiledTranslations;
39
+ /**
40
+ * Get the extraction manifest (keys + chunks).
41
+ * - keys: translation keys extracted from codebase with metadata
42
+ * - chunks: mapping of chunk names to their translation keys
43
+ */
44
+ getManifest(): ExtractionManifest;
45
+ getHashes(locale: string): Record<string, string>;
46
+ /**
47
+ * Clear translations for specified locale(s).
48
+ * @param locales - Locale(s) to clear, or all if not specified
49
+ */
50
+ clear(locales?: string | string[] | undefined): void;
51
+ private resolveLocales;
52
+ }
53
+ declare const i18n: I18nSingleton;
54
+
55
+ export { type FallbackBehavior as F, type I18nConfig as I, type I18nContext as a, i18n as i };
@@ -0,0 +1,62 @@
1
+ import { E as ExtractionManifest } from './types-C6rOJFY2.js';
2
+ import { a as TranslationMeta, C as CompiledTranslations, R as RawTranslations } from './types-CLWZeQhD.js';
3
+
4
+ /**
5
+ * Fallback behavior when translation is missing
6
+ */
7
+ type FallbackBehavior = 'key' | 'fallback' | 'throw' | ((key: string, meta?: TranslationMeta | undefined) => string);
8
+ /**
9
+ * Request-scoped i18n context
10
+ */
11
+ type I18nContext = {
12
+ locale: string;
13
+ translations: CompiledTranslations;
14
+ fallback: FallbackBehavior;
15
+ };
16
+
17
+ type I18nConfig = {
18
+ locales: string[];
19
+ defaultLocale?: string | undefined;
20
+ fallback?: FallbackBehavior | undefined;
21
+ };
22
+ type NormalizedConfig = {
23
+ locales: string[];
24
+ defaultLocale: string;
25
+ fallback: FallbackBehavior;
26
+ };
27
+ declare class I18nSingleton {
28
+ private config;
29
+ private rawCache;
30
+ private compiledCache;
31
+ private hashCache;
32
+ private manifestGetter;
33
+ configure(config: I18nConfig): void;
34
+ isConfigured(): boolean;
35
+ getConfig(): NormalizedConfig;
36
+ setTranslations(locale: string, raw: RawTranslations): void;
37
+ getTranslations(locale: string): RawTranslations;
38
+ getCompiledTranslations(locale: string): CompiledTranslations;
39
+ /**
40
+ * Get the extraction manifest (keys + chunks).
41
+ * - keys: translation keys extracted from codebase with metadata
42
+ * - chunks: mapping of chunk names to their translation keys
43
+ */
44
+ getManifest(): ExtractionManifest;
45
+ /**
46
+ * Set the manifest getter function (called by init module).
47
+ * In dev mode, this returns live data from the vite plugin.
48
+ * In production, this returns the static manifest loaded from JSON.
49
+ * @internal
50
+ */
51
+ setManifestGetter(getter: () => ExtractionManifest): void;
52
+ getHashes(locale: string): Record<string, string>;
53
+ /**
54
+ * Clear translations for specified locale(s).
55
+ * @param locales - Locale(s) to clear, or all if not specified
56
+ */
57
+ clear(locales?: string | string[] | undefined): void;
58
+ private resolveLocales;
59
+ }
60
+ declare const i18n: I18nSingleton;
61
+
62
+ export { type FallbackBehavior as F, type I18nContext as I, type I18nConfig as a, i18n as i };
@@ -0,0 +1,77 @@
1
+ import { T as TranslationMeta, C as CompiledTranslations, R as RawTranslations } from './types-nippsMkm.js';
2
+
3
+ /**
4
+ * Extracted metadata for a single translation key
5
+ */
6
+ type ExtractedKey = {
7
+ key: string;
8
+ meta: TranslationMeta;
9
+ file: string;
10
+ line: number;
11
+ };
12
+ /**
13
+ * Chunk-to-keys mapping produced by Vite plugin
14
+ */
15
+ type ChunkManifest = Record<string, string[]>;
16
+ /**
17
+ * Full extraction manifest
18
+ */
19
+ type ExtractionManifest = {
20
+ keys: ExtractedKey[];
21
+ chunks: ChunkManifest;
22
+ };
23
+
24
+ /**
25
+ * Fallback behavior when translation is missing
26
+ */
27
+ type FallbackBehavior = 'key' | 'fallback' | 'throw' | ((key: string, meta?: TranslationMeta | undefined) => string);
28
+ /**
29
+ * Request-scoped i18n context
30
+ */
31
+ type I18nContext = {
32
+ locale: string;
33
+ translations: CompiledTranslations;
34
+ fallback: FallbackBehavior;
35
+ meta: Record<string, TranslationMeta>;
36
+ };
37
+
38
+ type I18nConfig = {
39
+ locales: string[];
40
+ defaultLocale?: string | undefined;
41
+ fallback?: FallbackBehavior | undefined;
42
+ };
43
+ declare class I18nSingleton {
44
+ private config;
45
+ private rawCache;
46
+ private compiledCache;
47
+ private extractionManifest;
48
+ private hashCache;
49
+ configure(config: I18nConfig): void;
50
+ getConfig(): I18nConfig | null;
51
+ getDefaultLocale(): string | undefined;
52
+ getFallbackBehavior(): FallbackBehavior;
53
+ setTranslations(locale: string, raw: RawTranslations): void;
54
+ getTranslations(locale: string): RawTranslations | undefined;
55
+ getCompiledTranslations(locale: string): CompiledTranslations | undefined;
56
+ getChunkManifest(): ChunkManifest | null;
57
+ /**
58
+ * Get extracted translation keys with metadata.
59
+ * Use this to populate your CMS with keys extracted from the codebase.
60
+ */
61
+ getExtractedKeys(): ExtractedKey[] | null;
62
+ /**
63
+ * Get the full extraction manifest (keys + chunks).
64
+ * Returns null in dev mode (manifest doesn't exist).
65
+ */
66
+ getExtractionManifest(): ExtractionManifest | null;
67
+ getHashes(locale: string): Record<string, string> | undefined;
68
+ /**
69
+ * Clear translations for specified locale(s).
70
+ * @param locales - Locale(s) to clear, or all if not specified
71
+ */
72
+ clear(locales?: string | string[] | undefined): void;
73
+ private resolveLocales;
74
+ }
75
+ declare const i18n: I18nSingleton;
76
+
77
+ export { type ExtractedKey as E, type FallbackBehavior as F, type I18nConfig as I, type ExtractionManifest as a, type I18nContext as b, i18n as i };
@@ -0,0 +1,55 @@
1
+ import { a as ExtractionManifest } from './types-DsNK_9sI.js';
2
+ import { T as TranslationMeta, C as CompiledTranslations, R as RawTranslations } from './types-CiIDN2sW.js';
3
+
4
+ /**
5
+ * Fallback behavior when translation is missing
6
+ */
7
+ type FallbackBehavior = 'key' | 'fallback' | 'throw' | ((key: string, meta?: TranslationMeta | undefined) => string);
8
+ /**
9
+ * Request-scoped i18n context
10
+ */
11
+ type I18nContext = {
12
+ locale: string;
13
+ translations: CompiledTranslations;
14
+ fallback: FallbackBehavior;
15
+ };
16
+
17
+ type I18nConfig = {
18
+ locales: string[];
19
+ defaultLocale?: string | undefined;
20
+ fallback?: FallbackBehavior | undefined;
21
+ };
22
+ type NormalizedConfig = {
23
+ locales: string[];
24
+ defaultLocale: string;
25
+ fallback: FallbackBehavior;
26
+ };
27
+ declare class I18nSingleton {
28
+ private config;
29
+ private rawCache;
30
+ private compiledCache;
31
+ private hashCache;
32
+ private manifestGetter;
33
+ configure(config: I18nConfig): Promise<void>;
34
+ isConfigured(): boolean;
35
+ getConfig(): NormalizedConfig;
36
+ setTranslations(locale: string, raw: RawTranslations): void;
37
+ getTranslations(locale: string): RawTranslations;
38
+ getCompiledTranslations(locale: string): CompiledTranslations;
39
+ /**
40
+ * Get the extraction manifest (keys + chunks).
41
+ * - keys: translation keys extracted from codebase with metadata
42
+ * - chunks: mapping of chunk names to their translation keys
43
+ */
44
+ getManifest(): ExtractionManifest;
45
+ getHashes(locale: string): Record<string, string>;
46
+ /**
47
+ * Clear translations for specified locale(s).
48
+ * @param locales - Locale(s) to clear, or all if not specified
49
+ */
50
+ clear(locales?: string | string[] | undefined): void;
51
+ private resolveLocales;
52
+ }
53
+ declare const i18n: I18nSingleton;
54
+
55
+ export { type FallbackBehavior as F, type I18nConfig as I, type I18nContext as a, i18n as i };