@chipmobilesdk/rn-i18n 0.2.0 → 0.4.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 (201) hide show
  1. package/CHANGELOG.md +173 -0
  2. package/README.md +48 -17
  3. package/lib/commonjs/config/catalog.js +29 -0
  4. package/lib/commonjs/config/catalog.js.map +1 -0
  5. package/lib/commonjs/config/diagnostics.js +56 -0
  6. package/lib/commonjs/config/diagnostics.js.map +1 -0
  7. package/lib/commonjs/config/errors.js +35 -0
  8. package/lib/commonjs/config/errors.js.map +1 -0
  9. package/lib/commonjs/config/types.js +13 -0
  10. package/lib/commonjs/config/types.js.map +1 -0
  11. package/lib/commonjs/config/validateConfig.js +134 -0
  12. package/lib/commonjs/config/validateConfig.js.map +1 -0
  13. package/lib/commonjs/format/currency.js +35 -0
  14. package/lib/commonjs/format/currency.js.map +1 -0
  15. package/lib/commonjs/format/date.js +36 -0
  16. package/lib/commonjs/format/date.js.map +1 -0
  17. package/lib/commonjs/format/invalid.js +24 -0
  18. package/lib/commonjs/format/invalid.js.map +1 -0
  19. package/lib/commonjs/format/number.js +29 -0
  20. package/lib/commonjs/format/number.js.map +1 -0
  21. package/lib/commonjs/format/units.js +184 -0
  22. package/lib/commonjs/format/units.js.map +1 -0
  23. package/lib/commonjs/i18n.js +234 -0
  24. package/lib/commonjs/i18n.js.map +1 -0
  25. package/lib/commonjs/index.js +93 -0
  26. package/lib/commonjs/index.js.map +1 -0
  27. package/lib/commonjs/locale/activeLocale.js +37 -0
  28. package/lib/commonjs/locale/activeLocale.js.map +1 -0
  29. package/lib/commonjs/locale/deviceLocale.js +52 -0
  30. package/lib/commonjs/locale/deviceLocale.js.map +1 -0
  31. package/lib/commonjs/locale/keyValueStorage.js +29 -0
  32. package/lib/commonjs/locale/keyValueStorage.js.map +1 -0
  33. package/lib/commonjs/locale/persistence.js +74 -0
  34. package/lib/commonjs/locale/persistence.js.map +1 -0
  35. package/lib/commonjs/package.json +1 -0
  36. package/lib/commonjs/react/I18nProvider.js +36 -0
  37. package/lib/commonjs/react/I18nProvider.js.map +1 -0
  38. package/lib/commonjs/react/hooks.js +47 -0
  39. package/lib/commonjs/react/hooks.js.map +1 -0
  40. package/lib/commonjs/translation/interpolate.js +24 -0
  41. package/lib/commonjs/translation/interpolate.js.map +1 -0
  42. package/lib/commonjs/translation/plurals.js +122 -0
  43. package/lib/commonjs/translation/plurals.js.map +1 -0
  44. package/lib/commonjs/translation/resolver.js +124 -0
  45. package/lib/commonjs/translation/resolver.js.map +1 -0
  46. package/lib/commonjs/translation/runtimeKeys.js +55 -0
  47. package/lib/commonjs/translation/runtimeKeys.js.map +1 -0
  48. package/lib/module/config/catalog.js +25 -0
  49. package/lib/module/config/catalog.js.map +1 -0
  50. package/lib/module/config/diagnostics.js +51 -0
  51. package/lib/module/config/diagnostics.js.map +1 -0
  52. package/lib/module/config/errors.js +30 -0
  53. package/lib/module/config/errors.js.map +1 -0
  54. package/lib/module/config/types.js +26 -0
  55. package/lib/module/config/types.js.map +1 -0
  56. package/lib/module/config/validateConfig.js +131 -0
  57. package/lib/module/config/validateConfig.js.map +1 -0
  58. package/lib/module/format/currency.js +32 -0
  59. package/lib/module/format/currency.js.map +1 -0
  60. package/lib/module/format/date.js +33 -0
  61. package/lib/module/format/date.js.map +1 -0
  62. package/lib/module/format/invalid.js +21 -0
  63. package/lib/module/format/invalid.js.map +1 -0
  64. package/lib/module/format/number.js +26 -0
  65. package/lib/module/format/number.js.map +1 -0
  66. package/lib/module/format/units.js +171 -0
  67. package/lib/module/format/units.js.map +1 -0
  68. package/lib/module/i18n.js +230 -0
  69. package/lib/module/i18n.js.map +1 -0
  70. package/lib/module/index.js +23 -0
  71. package/lib/module/index.js.map +1 -0
  72. package/lib/module/locale/activeLocale.js +33 -0
  73. package/lib/module/locale/activeLocale.js.map +1 -0
  74. package/lib/module/locale/deviceLocale.js +46 -0
  75. package/lib/module/locale/deviceLocale.js.map +1 -0
  76. package/lib/module/locale/keyValueStorage.js +25 -0
  77. package/lib/module/locale/keyValueStorage.js.map +1 -0
  78. package/lib/module/locale/persistence.js +66 -0
  79. package/lib/module/locale/persistence.js.map +1 -0
  80. package/lib/module/package.json +1 -0
  81. package/lib/module/react/I18nProvider.js +29 -0
  82. package/lib/module/react/I18nProvider.js.map +1 -0
  83. package/lib/module/react/hooks.js +42 -0
  84. package/lib/module/react/hooks.js.map +1 -0
  85. package/lib/module/translation/interpolate.js +20 -0
  86. package/lib/module/translation/interpolate.js.map +1 -0
  87. package/lib/module/translation/plurals.js +114 -0
  88. package/lib/module/translation/plurals.js.map +1 -0
  89. package/lib/module/translation/resolver.js +118 -0
  90. package/lib/module/translation/resolver.js.map +1 -0
  91. package/lib/module/translation/runtimeKeys.js +50 -0
  92. package/lib/module/translation/runtimeKeys.js.map +1 -0
  93. package/lib/typescript/commonjs/config/catalog.d.ts +18 -0
  94. package/lib/typescript/commonjs/config/catalog.d.ts.map +1 -0
  95. package/lib/typescript/commonjs/config/diagnostics.d.ts +21 -0
  96. package/lib/typescript/commonjs/config/diagnostics.d.ts.map +1 -0
  97. package/lib/typescript/commonjs/config/errors.d.ts +16 -0
  98. package/lib/typescript/commonjs/config/errors.d.ts.map +1 -0
  99. package/lib/typescript/commonjs/config/types.d.ts +127 -0
  100. package/lib/typescript/commonjs/config/types.d.ts.map +1 -0
  101. package/lib/typescript/commonjs/config/validateConfig.d.ts +8 -0
  102. package/lib/typescript/commonjs/config/validateConfig.d.ts.map +1 -0
  103. package/lib/typescript/commonjs/format/currency.d.ts +12 -0
  104. package/lib/typescript/commonjs/format/currency.d.ts.map +1 -0
  105. package/lib/typescript/commonjs/format/date.d.ts +14 -0
  106. package/lib/typescript/commonjs/format/date.d.ts.map +1 -0
  107. package/lib/typescript/commonjs/format/invalid.d.ts +12 -0
  108. package/lib/typescript/commonjs/format/invalid.d.ts.map +1 -0
  109. package/lib/typescript/commonjs/format/number.d.ts +8 -0
  110. package/lib/typescript/commonjs/format/number.d.ts.map +1 -0
  111. package/lib/typescript/commonjs/format/units.d.ts +23 -0
  112. package/lib/typescript/commonjs/format/units.d.ts.map +1 -0
  113. package/lib/typescript/commonjs/i18n.d.ts +46 -0
  114. package/lib/typescript/commonjs/i18n.d.ts.map +1 -0
  115. package/lib/typescript/commonjs/index.d.ts +27 -0
  116. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  117. package/lib/typescript/commonjs/locale/activeLocale.d.ts +17 -0
  118. package/lib/typescript/commonjs/locale/activeLocale.d.ts.map +1 -0
  119. package/lib/typescript/commonjs/locale/deviceLocale.d.ts +19 -0
  120. package/lib/typescript/commonjs/locale/deviceLocale.d.ts.map +1 -0
  121. package/lib/typescript/commonjs/locale/keyValueStorage.d.ts +13 -0
  122. package/lib/typescript/commonjs/locale/keyValueStorage.d.ts.map +1 -0
  123. package/lib/typescript/commonjs/locale/persistence.d.ts +24 -0
  124. package/lib/typescript/commonjs/locale/persistence.d.ts.map +1 -0
  125. package/lib/typescript/commonjs/package.json +1 -0
  126. package/lib/typescript/commonjs/react/I18nProvider.d.ts +16 -0
  127. package/lib/typescript/commonjs/react/I18nProvider.d.ts.map +1 -0
  128. package/lib/typescript/commonjs/react/hooks.d.ts +21 -0
  129. package/lib/typescript/commonjs/react/hooks.d.ts.map +1 -0
  130. package/lib/typescript/commonjs/translation/interpolate.d.ts +8 -0
  131. package/lib/typescript/commonjs/translation/interpolate.d.ts.map +1 -0
  132. package/lib/typescript/commonjs/translation/plurals.d.ts +13 -0
  133. package/lib/typescript/commonjs/translation/plurals.d.ts.map +1 -0
  134. package/lib/typescript/commonjs/translation/resolver.d.ts +24 -0
  135. package/lib/typescript/commonjs/translation/resolver.d.ts.map +1 -0
  136. package/lib/typescript/commonjs/translation/runtimeKeys.d.ts +16 -0
  137. package/lib/typescript/commonjs/translation/runtimeKeys.d.ts.map +1 -0
  138. package/lib/typescript/module/config/catalog.d.ts +18 -0
  139. package/lib/typescript/module/config/catalog.d.ts.map +1 -0
  140. package/lib/typescript/module/config/diagnostics.d.ts +21 -0
  141. package/lib/typescript/module/config/diagnostics.d.ts.map +1 -0
  142. package/lib/typescript/module/config/errors.d.ts +16 -0
  143. package/lib/typescript/module/config/errors.d.ts.map +1 -0
  144. package/lib/typescript/module/config/types.d.ts +127 -0
  145. package/lib/typescript/module/config/types.d.ts.map +1 -0
  146. package/lib/typescript/module/config/validateConfig.d.ts +8 -0
  147. package/lib/typescript/module/config/validateConfig.d.ts.map +1 -0
  148. package/lib/typescript/module/format/currency.d.ts +12 -0
  149. package/lib/typescript/module/format/currency.d.ts.map +1 -0
  150. package/lib/typescript/module/format/date.d.ts +14 -0
  151. package/lib/typescript/module/format/date.d.ts.map +1 -0
  152. package/lib/typescript/module/format/invalid.d.ts +12 -0
  153. package/lib/typescript/module/format/invalid.d.ts.map +1 -0
  154. package/lib/typescript/module/format/number.d.ts +8 -0
  155. package/lib/typescript/module/format/number.d.ts.map +1 -0
  156. package/lib/typescript/module/format/units.d.ts +23 -0
  157. package/lib/typescript/module/format/units.d.ts.map +1 -0
  158. package/lib/typescript/module/i18n.d.ts +46 -0
  159. package/lib/typescript/module/i18n.d.ts.map +1 -0
  160. package/lib/typescript/module/index.d.ts +27 -0
  161. package/lib/typescript/module/index.d.ts.map +1 -0
  162. package/lib/typescript/module/locale/activeLocale.d.ts +17 -0
  163. package/lib/typescript/module/locale/activeLocale.d.ts.map +1 -0
  164. package/lib/typescript/module/locale/deviceLocale.d.ts +19 -0
  165. package/lib/typescript/module/locale/deviceLocale.d.ts.map +1 -0
  166. package/lib/typescript/module/locale/keyValueStorage.d.ts +13 -0
  167. package/lib/typescript/module/locale/keyValueStorage.d.ts.map +1 -0
  168. package/lib/typescript/module/locale/persistence.d.ts +24 -0
  169. package/lib/typescript/module/locale/persistence.d.ts.map +1 -0
  170. package/lib/typescript/module/package.json +1 -0
  171. package/lib/typescript/module/react/I18nProvider.d.ts +16 -0
  172. package/lib/typescript/module/react/I18nProvider.d.ts.map +1 -0
  173. package/lib/typescript/module/react/hooks.d.ts +21 -0
  174. package/lib/typescript/module/react/hooks.d.ts.map +1 -0
  175. package/lib/typescript/module/translation/interpolate.d.ts +8 -0
  176. package/lib/typescript/module/translation/interpolate.d.ts.map +1 -0
  177. package/lib/typescript/module/translation/plurals.d.ts +13 -0
  178. package/lib/typescript/module/translation/plurals.d.ts.map +1 -0
  179. package/lib/typescript/module/translation/resolver.d.ts +24 -0
  180. package/lib/typescript/module/translation/resolver.d.ts.map +1 -0
  181. package/lib/typescript/module/translation/runtimeKeys.d.ts +16 -0
  182. package/lib/typescript/module/translation/runtimeKeys.d.ts.map +1 -0
  183. package/package.json +41 -18
  184. package/skills/sdk-rn-i18n/SKILL.md +27 -0
  185. package/src/config/diagnostics.ts +2 -0
  186. package/src/format/currency.ts +5 -0
  187. package/src/format/date.ts +10 -4
  188. package/src/i18n.ts +93 -9
  189. package/src/index.ts +5 -3
  190. package/src/locale/activeLocale.ts +10 -0
  191. package/src/locale/persistence.ts +19 -0
  192. package/src/translation/plurals.ts +74 -5
  193. package/src/translation/runtimeKeys.ts +28 -1
  194. package/src/tooling/cli.ts +0 -76
  195. package/src/tooling/generateKeys.ts +0 -62
  196. package/src/tooling/index.ts +0 -27
  197. package/src/tooling/report.ts +0 -109
  198. package/src/tooling/runner.ts +0 -111
  199. package/src/tooling/scan.ts +0 -193
  200. package/src/tooling/sync.ts +0 -193
  201. package/src/tooling/types.ts +0 -119
@@ -0,0 +1,46 @@
1
+ import type { ActiveLocalePreference, I18nConfig, LocaleConfig, RuntimeTranslationEntry, TranslateOptions, TranslateVars, UnitId } from './config/types';
2
+ import type { UnitFormatOptions } from './format/units';
3
+ export interface I18n<TKey extends string = string> {
4
+ /** Resolves the initial locale: persisted → device → primary fallback. */
5
+ init(): Promise<void>;
6
+ /**
7
+ * `init()` without waiting, before the first render (PERF-08). Resolves the locale
8
+ * and returns true when it can do so synchronously: persistence is off, or the
9
+ * storage adapter has `getItemSync`. Returns false, changing nothing, when the
10
+ * adapter can only read asynchronously; call `init()` then.
11
+ */
12
+ initSync(): boolean;
13
+ t(key: TKey, vars?: TranslateVars, options?: TranslateOptions): string;
14
+ getLocale(): ActiveLocalePreference;
15
+ /** Switches at runtime without restart and persists best-effort. */
16
+ setLocale(code: string): Promise<void>;
17
+ /**
18
+ * Forgets the stored choice and follows the device again — the "System
19
+ * language" option a settings screen offers (I18N-17). Resolves to the
20
+ * locale now active.
21
+ */
22
+ useDeviceLocale(): Promise<ActiveLocalePreference>;
23
+ getSupportedLocales(): readonly LocaleConfig[];
24
+ formatNumber(value: number, options?: Intl.NumberFormatOptions): string;
25
+ /**
26
+ * Options are merged over the locale's default (`{ month: 'long' }` keeps the
27
+ * year and day). `replaceDefaults` uses only what is passed.
28
+ */
29
+ formatDate(value: Date | number, options?: Intl.DateTimeFormatOptions, formatting?: {
30
+ replaceDefaults?: boolean;
31
+ }): string;
32
+ formatCurrency(value: number, currency?: string, options?: Intl.NumberFormatOptions): string;
33
+ formatUnit(value: number, options?: UnitFormatOptions): string;
34
+ convertUnit(value: number, from: UnitId, to: UnitId): number;
35
+ registerRuntimeEntries(entries: readonly RuntimeTranslationEntry[]): void;
36
+ subscribe(listener: () => void): () => void;
37
+ getVersion(): number;
38
+ }
39
+ /**
40
+ * Creates an I18n instance from an app-owned configuration. Validation runs
41
+ * eagerly and throws an I18nConfigError before any localized content can be
42
+ * served (FR-003). Pass the app's generated key type for typed lookups:
43
+ * `createI18n<AppI18nKey>(config)`.
44
+ */
45
+ export declare function createI18n<TKey extends string = string>(config: I18nConfig): I18n<TKey>;
46
+ //# sourceMappingURL=i18n.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../src/i18n.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACX,sBAAsB,EACtB,UAAU,EAEV,YAAY,EAEZ,uBAAuB,EACvB,gBAAgB,EAChB,aAAa,EACb,MAAM,EACN,MAAM,gBAAgB,CAAC;AAkBxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,MAAM,WAAW,IAAI,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM;IACjD,0EAA0E;IAC1E,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB;;;;;OAKG;IACH,QAAQ,IAAI,OAAO,CAAC;IACpB,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAAC;IACvE,SAAS,IAAI,sBAAsB,CAAC;IACpC,oEAAoE;IACpE,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC;;;;OAIG;IACH,eAAe,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACnD,mBAAmB,IAAI,SAAS,YAAY,EAAE,CAAC;IAC/C,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,GAAG,MAAM,CAAC;IACxE;;;OAGG;IACH,UAAU,CACT,KAAK,EAAE,IAAI,GAAG,MAAM,EACpB,OAAO,CAAC,EAAE,IAAI,CAAC,qBAAqB,EACpC,UAAU,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,OAAO,CAAA;KAAE,GACxC,MAAM,CAAC;IACV,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,GAAG,MAAM,CAAC;IAC7F,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAAC;IAC/D,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7D,sBAAsB,CAAC,OAAO,EAAE,SAAS,uBAAuB,EAAE,GAAG,IAAI,CAAC;IAC1E,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;IAC5C,UAAU,IAAI,MAAM,CAAC;CACrB;AAKD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,CA0OvF"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @chipmobilesdk/rn-i18n — reusable localization for ChipMobileSdk-family
3
+ * React Native apps.
4
+ *
5
+ * This is the single entrypoint, and the package is React Native code only. The
6
+ * Node-only extraction and synchronization tooling is a package of its own,
7
+ * `@chipmobilesdk/rn-i18n-tooling` (the `chip-i18n` CLI): it used to ship inside
8
+ * this tarball as TypeScript source under `./tooling`, which no consumer could
9
+ * execute.
10
+ */
11
+ export { createI18n } from './i18n';
12
+ export type { I18n } from './i18n';
13
+ export { I18nConfigError } from './config/types';
14
+ export { runtimeEntriesFromCatalog } from './config/catalog';
15
+ export { localeStorageFromKeyValue } from './locale/keyValueStorage';
16
+ export type { I18nErrorCode } from './config/errors';
17
+ export type { I18nDiagnostic, I18nDiagnosticCode, I18nDiagnosticHandler, } from './config/diagnostics';
18
+ export type { ActiveLocalePreference, DeviceLocaleProvider, I18nConfig, InvalidFormatPolicy, LocaleConfig, LocaleDirection, LocaleSelectionSource, LocaleStorageAdapter, MissingTranslationPolicy, PluralCategory, PluralRule, RuntimeTranslationEntry, TranslateOptions, TranslateVars, TranslationNamespace, TranslationNode, TranslationResources, UnitDimension, UnitId, } from './config/types';
19
+ export { LOCALE_STORAGE_KEY } from './locale/persistence';
20
+ export { defaultDeviceLocaleProvider } from './locale/deviceLocale';
21
+ export { SUPPORTED_UNITS, UnitConversionError, convertUnitValue as convertUnit, getUnitSymbol, } from './format/units';
22
+ export type { UnitFormatOptions } from './format/units';
23
+ export { I18nProvider } from './react/I18nProvider';
24
+ export type { I18nProviderProps } from './react/I18nProvider';
25
+ export { useLocale, useTranslation } from './react/hooks';
26
+ export type { UseLocaleResult, UseTranslationResult } from './react/hooks';
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,YAAY,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEnC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,YAAY,EACX,cAAc,EACd,kBAAkB,EAClB,qBAAqB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACX,sBAAsB,EACtB,oBAAoB,EACpB,UAAU,EACV,mBAAmB,EACnB,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,EACxB,cAAc,EACd,UAAU,EACV,uBAAuB,EACvB,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,aAAa,EACb,MAAM,GACN,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAEpE,OAAO,EACN,eAAe,EACf,mBAAmB,EACnB,gBAAgB,IAAI,WAAW,EAC/B,aAAa,GACb,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,YAAY,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC1D,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { type I18nDiagnosticHandler } from '../config/diagnostics';
2
+ import type { ActiveLocalePreference } from '../config/types';
3
+ export interface ActiveLocaleStore {
4
+ get(): ActiveLocalePreference;
5
+ set(preference: ActiveLocalePreference): void;
6
+ subscribe(listener: () => void): () => void;
7
+ /**
8
+ * Notifies subscribers without changing the locale: what reaches the screen
9
+ * changed, not which language it is in (a runtime entry registered by a
10
+ * lazily loaded feature, say).
11
+ */
12
+ bump(): void;
13
+ /** Monotonic change counter consumed by useSyncExternalStore. */
14
+ getVersion(): number;
15
+ }
16
+ export declare function createActiveLocaleStore(initial: ActiveLocalePreference, report?: I18nDiagnosticHandler): ActiveLocaleStore;
17
+ //# sourceMappingURL=activeLocale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activeLocale.d.ts","sourceRoot":"","sources":["../../../../src/locale/activeLocale.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkC,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAE9D,MAAM,WAAW,iBAAiB;IACjC,GAAG,IAAI,sBAAsB,CAAC;IAC9B,GAAG,CAAC,UAAU,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAC9C,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;IAC5C;;;;OAIG;IACH,IAAI,IAAI,IAAI,CAAC;IACb,iEAAiE;IACjE,UAAU,IAAI,MAAM,CAAC;CACrB;AAED,wBAAgB,uBAAuB,CACtC,OAAO,EAAE,sBAAsB,EAC/B,MAAM,GAAE,qBAAuC,GAC7C,iBAAiB,CA6BnB"}
@@ -0,0 +1,19 @@
1
+ import type { DeviceLocaleProvider, LocaleConfig, LocaleSelectionSource } from '../config/types';
2
+ /**
3
+ * Default device locale detection. Hermes resolves the Intl default locale
4
+ * from the device locale on both Android and iOS, so no native module is
5
+ * required. Apps may inject their own provider (e.g. react-native-localize)
6
+ * through `I18nConfig.deviceLocale`.
7
+ */
8
+ export declare const defaultDeviceLocaleProvider: DeviceLocaleProvider;
9
+ export interface DeviceLocaleMatch {
10
+ code: string;
11
+ source: Extract<LocaleSelectionSource, 'device' | 'languageMatch'>;
12
+ }
13
+ /**
14
+ * Matches a detected device locale against the supported locales: an exact
15
+ * (case-insensitive) match wins; otherwise a device language that matches
16
+ * exactly one supported locale selects that locale (US4 scenario 3).
17
+ */
18
+ export declare function matchSupportedLocale(deviceLocale: string | undefined, locales: readonly LocaleConfig[]): DeviceLocaleMatch | undefined;
19
+ //# sourceMappingURL=deviceLocale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deviceLocale.d.ts","sourceRoot":"","sources":["../../../../src/locale/deviceLocale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAEjG;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,EAAE,oBAMzC,CAAC;AAEF,MAAM,WAAW,iBAAiB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC,qBAAqB,EAAE,QAAQ,GAAG,eAAe,CAAC,CAAC;CACnE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CACnC,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,OAAO,EAAE,SAAS,YAAY,EAAE,GAC9B,iBAAiB,GAAG,SAAS,CAoB/B"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * A `LocaleStorageAdapter` over rn-core's synchronous `KeyValuePort` (PERF-08).
3
+ *
4
+ * The adapter carries `getItemSync`, so `i18n.initSync()` resolves the persisted
5
+ * locale before the first render. Open the port the way the app opens its other
6
+ * durable state, for example `openDurable(() => createMMKV({ id: 'app' }))`.
7
+ */
8
+ import type { KeyValuePort } from '@chipmobilesdk/rn-core';
9
+ import type { LocaleStorageAdapter } from '../config/types';
10
+ export declare function localeStorageFromKeyValue(port: KeyValuePort): LocaleStorageAdapter & {
11
+ getItemSync(key: string): string | null;
12
+ };
13
+ //# sourceMappingURL=keyValueStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyValueStorage.d.ts","sourceRoot":"","sources":["../../../../src/locale/keyValueStorage.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,wBAAgB,yBAAyB,CACxC,IAAI,EAAE,YAAY,GAChB,oBAAoB,GAAG;IAAE,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;CAAE,CAapE"}
@@ -0,0 +1,24 @@
1
+ import { type I18nDiagnosticHandler } from '../config/diagnostics';
2
+ import type { LocaleStorageAdapter } from '../config/types';
3
+ export declare const LOCALE_STORAGE_KEY = "@chipmobilesdk/rn-i18n:locale";
4
+ /**
5
+ * Reads the persisted locale preference. Adapter failures are reported and
6
+ * treated as "no persisted value" so locale selection never crashes (FR-015).
7
+ */
8
+ export declare function readPersistedLocale(storage: LocaleStorageAdapter, report?: I18nDiagnosticHandler): Promise<string | null>;
9
+ /** `readPersistedLocale` for a store with a synchronous read; same failure handling. */
10
+ export declare function readPersistedLocaleSync(storage: LocaleStorageAdapter & {
11
+ getItemSync(key: string): string | null;
12
+ }, report?: I18nDiagnosticHandler): string | null;
13
+ /**
14
+ * Persists the selected locale. Persistence is best-effort: a write failure
15
+ * is reported but the in-memory locale switch stays authoritative.
16
+ */
17
+ export declare function writePersistedLocale(storage: LocaleStorageAdapter, code: string, report?: I18nDiagnosticHandler): Promise<void>;
18
+ /**
19
+ * Forgets the stored choice, so the next launch follows the device again. The
20
+ * adapter's `removeItem` was required by the contract and called by nothing
21
+ * until `useDeviceLocale()` (I18N-17). Best-effort, like the write.
22
+ */
23
+ export declare function clearPersistedLocale(storage: LocaleStorageAdapter, report?: I18nDiagnosticHandler): Promise<void>;
24
+ //# sourceMappingURL=persistence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"persistence.d.ts","sourceRoot":"","sources":["../../../../src/locale/persistence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,eAAO,MAAM,kBAAkB,kCAAkC,CAAC;AAElE;;;GAGG;AACH,wBAAsB,mBAAmB,CACxC,OAAO,EAAE,oBAAoB,EAC7B,MAAM,GAAE,qBAAuC,GAC7C,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAUxB;AAED,wFAAwF;AACxF,wBAAgB,uBAAuB,CACtC,OAAO,EAAE,oBAAoB,GAAG;IAAE,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;CAAE,EAC3E,MAAM,GAAE,qBAAuC,GAC7C,MAAM,GAAG,IAAI,CAUf;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CACzC,OAAO,EAAE,oBAAoB,EAC7B,IAAI,EAAE,MAAM,EACZ,MAAM,GAAE,qBAAuC,GAC7C,OAAO,CAAC,IAAI,CAAC,CAUf;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACzC,OAAO,EAAE,oBAAoB,EAC7B,MAAM,GAAE,qBAAuC,GAC7C,OAAO,CAAC,IAAI,CAAC,CASf"}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import type { ReactNode } from 'react';
3
+ import type { I18n } from '../i18n';
4
+ export declare const I18nContext: React.Context<I18n<string> | null>;
5
+ export interface I18nProviderProps {
6
+ i18n: I18n<never>;
7
+ children: ReactNode;
8
+ }
9
+ /**
10
+ * Provides the I18n instance to the React tree. Locale changes re-render
11
+ * consumers through the hooks' useSyncExternalStore subscription, so a
12
+ * runtime switch updates UI within one interaction cycle (PERF-002).
13
+ */
14
+ export declare function I18nProvider({ i18n, children }: I18nProviderProps): React.JSX.Element;
15
+ export declare function useI18nContext(): I18n<string>;
16
+ //# sourceMappingURL=I18nProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"I18nProvider.d.ts","sourceRoot":"","sources":["../../../../src/react/I18nProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAIpC,eAAO,MAAM,WAAW,oCAA2C,CAAC;AAEpE,MAAM,WAAW,iBAAiB;IACjC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,iBAAiB,qBAIjE;AAED,wBAAgB,cAAc,IAAI,IAAI,CAAC,MAAM,CAAC,CAM7C"}
@@ -0,0 +1,21 @@
1
+ import type { ActiveLocalePreference, LocaleConfig, LocaleDirection, TranslateOptions, TranslateVars } from '../config/types';
2
+ export interface UseTranslationResult<TKey extends string> {
3
+ t: (key: TKey, vars?: TranslateVars, options?: TranslateOptions) => string;
4
+ locale: string;
5
+ }
6
+ /**
7
+ * Returns the translation function bound to the active locale. Pass the
8
+ * app's generated key type for compile-time key validation (FR-041):
9
+ * `const { t } = useTranslation<AppI18nKey>();`
10
+ */
11
+ export declare function useTranslation<TKey extends string = string>(): UseTranslationResult<TKey>;
12
+ export interface UseLocaleResult {
13
+ locale: string;
14
+ direction: LocaleDirection;
15
+ preference: ActiveLocalePreference;
16
+ supportedLocales: readonly LocaleConfig[];
17
+ setLocale: (code: string) => Promise<void>;
18
+ }
19
+ /** Returns active locale state, direction metadata, and the locale switcher. */
20
+ export declare function useLocale(): UseLocaleResult;
21
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../src/react/hooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,sBAAsB,EACtB,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,MAAM,iBAAiB,CAAC;AAQzB,MAAM,WAAW,oBAAoB,CAAC,IAAI,SAAS,MAAM;IACxD,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,gBAAgB,KAAK,MAAM,CAAC;IAC3E,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM,KAAK,oBAAoB,CAAC,IAAI,CAAC,CAezF;AAED,MAAM,WAAW,eAAe;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,eAAe,CAAC;IAC3B,UAAU,EAAE,sBAAsB,CAAC;IACnC,gBAAgB,EAAE,SAAS,YAAY,EAAE,CAAC;IAC1C,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C;AAED,gFAAgF;AAChF,wBAAgB,SAAS,IAAI,eAAe,CAc3C"}
@@ -0,0 +1,8 @@
1
+ import type { TranslateVars } from '../config/types';
2
+ /**
3
+ * Replaces `{{name}}` placeholders with named values. Missing variables keep
4
+ * their placeholder text so the result stays deterministic, and each missing
5
+ * name is reported through `onMissingVariable`.
6
+ */
7
+ export declare function interpolate(text: string, vars?: TranslateVars, onMissingVariable?: (name: string) => void): string;
8
+ //# sourceMappingURL=interpolate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interpolate.d.ts","sourceRoot":"","sources":["../../../../src/translation/interpolate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIrD;;;;GAIG;AACH,wBAAgB,WAAW,CAC1B,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,aAAa,EACpB,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GACxC,MAAM,CASR"}
@@ -0,0 +1,13 @@
1
+ import type { LocaleConfig, PluralCategory, PluralRule, TranslationNode } from '../config/types';
2
+ export declare const PLURAL_CATEGORIES: readonly PluralCategory[];
3
+ export declare const DEFAULT_PLURAL_RULE: PluralRule;
4
+ /** True when this package has a rule for the language, or the locale brought one. */
5
+ export declare function hasPluralRule(locale: LocaleConfig): boolean;
6
+ export declare function resolvePluralRule(locale: LocaleConfig): PluralRule;
7
+ /**
8
+ * A plural group is an object whose keys are all plural categories, whose
9
+ * values are all strings, and which provides the required `other` variant.
10
+ */
11
+ export declare function isPluralGroup(node: TranslationNode): node is Record<string, string>;
12
+ export declare function selectPluralVariant(group: Record<string, string>, category: PluralCategory): string;
13
+ //# sourceMappingURL=plurals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plurals.d.ts","sourceRoot":"","sources":["../../../../src/translation/plurals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEjG,eAAO,MAAM,iBAAiB,EAAE,SAAS,cAAc,EAOtD,CAAC;AA8EF,eAAO,MAAM,mBAAmB,EAAE,UAAyB,CAAC;AAE5D,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAM3D;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,UAAU,CAMlE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAanF;AAED,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC7B,QAAQ,EAAE,cAAc,GACtB,MAAM,CAER"}
@@ -0,0 +1,24 @@
1
+ import type { I18nDiagnostic, I18nDiagnosticHandler } from '../config/diagnostics';
2
+ import type { LocaleConfig, MissingTranslationPolicy, TranslateOptions, TranslateVars, TranslationNamespace, TranslationNode, TranslationResources } from '../config/types';
3
+ import type { RuntimeEntryRegistry } from './runtimeKeys';
4
+ export interface ResolverContext {
5
+ localesByCode: ReadonlyMap<string, LocaleConfig>;
6
+ resources: TranslationResources;
7
+ runtimeEntries: RuntimeEntryRegistry;
8
+ missingTranslation: MissingTranslationPolicy;
9
+ /** Dedupe set so each failed lookup path warns exactly once. */
10
+ warned: Set<string>;
11
+ report: I18nDiagnosticHandler;
12
+ }
13
+ export declare function warnOnce(context: Pick<ResolverContext, 'warned' | 'report'>, dedupeKey: string, diagnostic: I18nDiagnostic): void;
14
+ /** Walks a dot-path key through a nested translation namespace. */
15
+ export declare function getTranslationNode(namespace: TranslationNamespace | undefined, key: string): TranslationNode | undefined;
16
+ /**
17
+ * Resolves a key through the active locale, its ordered fallback chain, and
18
+ * declared runtime-only default text, applying plural selection and named
19
+ * variable interpolation. Misses are reported with one console warning per
20
+ * lookup path; a full-chain miss applies the configured missing-translation
21
+ * policy (FR-008…FR-011, FR-033).
22
+ */
23
+ export declare function translate(context: ResolverContext, activeCode: string, key: string, vars?: TranslateVars, options?: TranslateOptions): string;
24
+ //# sourceMappingURL=resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../../../src/translation/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,KAAK,EACX,YAAY,EACZ,wBAAwB,EACxB,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,WAAW,eAAe;IAC/B,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACjD,SAAS,EAAE,oBAAoB,CAAC;IAChC,cAAc,EAAE,oBAAoB,CAAC;IACrC,kBAAkB,EAAE,wBAAwB,CAAC;IAC7C,gEAAgE;IAChE,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACpB,MAAM,EAAE,qBAAqB,CAAC;CAC9B;AAQD,wBAAgB,QAAQ,CACvB,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,QAAQ,GAAG,QAAQ,CAAC,EACnD,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,cAAc,GACxB,IAAI,CAWN;AAED,mEAAmE;AACnE,wBAAgB,kBAAkB,CACjC,SAAS,EAAE,oBAAoB,GAAG,SAAS,EAC3C,GAAG,EAAE,MAAM,GACT,eAAe,GAAG,SAAS,CAgB7B;AA4BD;;;;;;GAMG;AACH,wBAAgB,SAAS,CACxB,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,aAAa,EACpB,OAAO,CAAC,EAAE,gBAAgB,GACxB,MAAM,CAoDR"}
@@ -0,0 +1,16 @@
1
+ import { type RuntimeTranslationEntry } from '../config/types';
2
+ /**
3
+ * Registry of declared runtime-only translation entries. Entries participate
4
+ * in the same lookup pipeline as scanned template keys and are protected from
5
+ * removal during locale JSON synchronization.
6
+ */
7
+ export type RuntimeEntryRegistry = Map<string, RuntimeTranslationEntry>;
8
+ export declare function createRuntimeRegistry(entries?: readonly RuntimeTranslationEntry[]): RuntimeEntryRegistry;
9
+ /**
10
+ * The same checks the configured entries get (I18N-06): an entry registered at
11
+ * runtime by a lazily loaded feature used to be written in unvalidated, so a
12
+ * missing key or a non-string default surfaced only when a screen rendered it.
13
+ */
14
+ export declare function validateRuntimeEntries(entries: readonly RuntimeTranslationEntry[]): void;
15
+ export declare function registerRuntimeEntries(registry: RuntimeEntryRegistry, entries: readonly RuntimeTranslationEntry[]): void;
16
+ //# sourceMappingURL=runtimeKeys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeKeys.d.ts","sourceRoot":"","sources":["../../../../src/translation/runtimeKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAEhF;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,GAAG,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;AAExE,wBAAgB,qBAAqB,CACpC,OAAO,CAAC,EAAE,SAAS,uBAAuB,EAAE,GAC1C,oBAAoB,CAMtB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,SAAS,uBAAuB,EAAE,GAAG,IAAI,CAmBxF;AAED,wBAAgB,sBAAsB,CACrC,QAAQ,EAAE,oBAAoB,EAC9B,OAAO,EAAE,SAAS,uBAAuB,EAAE,GACzC,IAAI,CAKN"}
@@ -0,0 +1,18 @@
1
+ import type { RuntimeTranslationEntry } from './types.js';
2
+ /**
3
+ * Runtime entries for a package's message catalog (I18N-13), so an app registers
4
+ * an SDK's copy in one line and translates it like its own:
5
+ *
6
+ * ```ts
7
+ * createI18n({ ...config, runtimeEntries: runtimeEntriesFromCatalog(paymentMessages.user) });
8
+ * ```
9
+ *
10
+ * Catalogs mark variables `{name}`; rn-i18n's are `{{name}}`, so they are
11
+ * converted. `policy: 'add'` lets the sync CLI write missing keys into each locale
12
+ * file with the default text.
13
+ */
14
+ export declare function runtimeEntriesFromCatalog(catalog: Readonly<Record<string, string>>, options?: {
15
+ readonly policy?: 'add' | 'report';
16
+ readonly description?: string;
17
+ }): RuntimeTranslationEntry[];
18
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../../src/config/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAS,CAAC;AAEvD;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CACxC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EACzC,OAAO,GAAE;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO,GACjF,uBAAuB,EAAE,CAO3B"}
@@ -0,0 +1,21 @@
1
+ /** What rn-i18n reports. Stable: an app may branch on these. */
2
+ export type I18nDiagnosticCode = 'missing_translation' | 'fallback_used' | 'missing_variable' | 'invalid_value' | 'invalid_format' | 'locale_unsupported' | 'plural_rule_default' | 'locale_read_failed' | 'locale_write_failed' | 'listener_threw';
3
+ export interface I18nDiagnostic {
4
+ readonly code: I18nDiagnosticCode;
5
+ /** For people: names the key, locale or variable involved. */
6
+ readonly message: string;
7
+ readonly key?: string;
8
+ readonly locale?: string;
9
+ }
10
+ export type I18nDiagnosticHandler = (diagnostic: I18nDiagnostic) => void;
11
+ /**
12
+ * One place every diagnostic goes through (I18N-11): the app's SDK sinks always
13
+ * (`installSdkSink` from rn-core), then `onDiagnostic` when the app gave one,
14
+ * otherwise `console.warn` in development builds and tests only.
15
+ */
16
+ export declare function createReporter(onDiagnostic?: I18nDiagnosticHandler): I18nDiagnosticHandler;
17
+ /** For the few call sites that run before or outside an i18n instance. */
18
+ export declare const defaultReporter: I18nDiagnosticHandler;
19
+ /** Foreign error text, shaped before it reaches a message. */
20
+ export declare function describeError(error: unknown): string;
21
+ //# sourceMappingURL=diagnostics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../../../src/config/diagnostics.ts"],"names":[],"mappings":"AAMA,gEAAgE;AAChE,MAAM,MAAM,kBAAkB,GAC3B,qBAAqB,GACrB,eAAe,GACf,kBAAkB,GAClB,eAAe,GACf,gBAAgB,GAChB,oBAAoB,GACpB,qBAAqB,GACrB,oBAAoB,GACpB,qBAAqB,GACrB,gBAAgB,CAAC;AAEpB,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC,8DAA8D;IAC9D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,qBAAqB,GAAG,CAAC,UAAU,EAAE,cAAc,KAAK,IAAI,CAAC;AAiBzE;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,YAAY,CAAC,EAAE,qBAAqB,GAAG,qBAAqB,CAY1F;AAED,0EAA0E;AAC1E,eAAO,MAAM,eAAe,uBAAmB,CAAC;AAEhD,8DAA8D;AAC9D,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEpD"}
@@ -0,0 +1,16 @@
1
+ import { SdkError } from '@chipmobilesdk/rn-core';
2
+ /** The package's error codes. */
3
+ export type I18nErrorCode = 'invalid_config' | 'unit_conversion';
4
+ /**
5
+ * Configuration error listing every detected violation. An `SdkError`
6
+ * (`@chipmobilesdk/rn-core`) with `pkg: 'rn-i18n'`.
7
+ */
8
+ export declare class I18nConfigError extends SdkError<I18nErrorCode> {
9
+ readonly issues: readonly string[];
10
+ constructor(issues: readonly string[]);
11
+ }
12
+ /** A unit conversion the package cannot perform, such as across dimensions. */
13
+ export declare class UnitConversionError extends SdkError<I18nErrorCode> {
14
+ constructor(message: string);
15
+ }
16
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/config/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,iCAAiC;AACjC,MAAM,MAAM,aAAa,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;AAEjE;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,QAAQ,CAAC,aAAa,CAAC;IAC3D,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;gBAEvB,MAAM,EAAE,SAAS,MAAM,EAAE;CAOrC;AAED,+EAA+E;AAC/E,qBAAa,mBAAoB,SAAQ,QAAQ,CAAC,aAAa,CAAC;gBACnD,OAAO,EAAE,MAAM;CAI3B"}
@@ -0,0 +1,127 @@
1
+ /**
2
+ * Public configuration and contract types for @chipmobilesdk/rn-i18n.
3
+ *
4
+ * The package has one runtime dependency, rn-core; formatting uses the Intl APIs
5
+ * built into Hermes (Intl.NumberFormat, Intl.DateTimeFormat), while plural
6
+ * rules and unit conversion are package-owned because Intl.PluralRules and
7
+ * Intl unit-style formatting are not reliably available in Hermes.
8
+ */
9
+ import type { I18nDiagnosticHandler } from './diagnostics.js';
10
+ export type LocaleDirection = 'ltr' | 'rtl';
11
+ export type PluralCategory = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';
12
+ export type PluralRule = (count: number) => PluralCategory;
13
+ export type UnitDimension = 'length' | 'mass' | 'volume' | 'temperature';
14
+ export type UnitId = 'millimeter' | 'centimeter' | 'meter' | 'kilometer' | 'inch' | 'foot' | 'mile' | 'gram' | 'kilogram' | 'ounce' | 'pound' | 'milliliter' | 'liter' | 'gallon' | 'celsius' | 'fahrenheit' | 'kelvin';
15
+ export interface LocaleConfig {
16
+ /** BCP-47 language-region code, e.g. `vi-VN`, `en-US`, `ja-JP`. */
17
+ code: string;
18
+ displayName: string;
19
+ direction: LocaleDirection;
20
+ /**
21
+ * Ordered locale codes consulted when a key is missing from this locale.
22
+ * Every entry must be another supported locale; cycles, duplicates, and
23
+ * self-references are rejected during setup validation.
24
+ */
25
+ fallbackChain: string[];
26
+ /** ISO-4217 currency code used when no explicit currency is requested. */
27
+ defaultCurrency: string;
28
+ defaultUnit: UnitId;
29
+ /**
30
+ * Default Intl.DateTimeFormat options for this locale. Restricted to the
31
+ * component options supported by Hermes on both Android and iOS.
32
+ */
33
+ defaultDateFormat: Intl.DateTimeFormatOptions;
34
+ /** Default Intl.NumberFormat options for this locale. */
35
+ defaultNumberFormat: Intl.NumberFormatOptions;
36
+ /** Optional plural rule override; defaults to the built-in language rule. */
37
+ pluralRule?: PluralRule;
38
+ }
39
+ export type TranslationNode = string | {
40
+ [key: string]: TranslationNode;
41
+ };
42
+ export type TranslationNamespace = {
43
+ [key: string]: TranslationNode;
44
+ };
45
+ /** App-owned translation resources keyed by locale code. */
46
+ export type TranslationResources = {
47
+ [localeCode: string]: TranslationNamespace;
48
+ };
49
+ /**
50
+ * A translation key intentionally resolved at runtime and therefore not
51
+ * discoverable by static source scanning. Declared entries are protected
52
+ * from removal during locale JSON synchronization.
53
+ */
54
+ export interface RuntimeTranslationEntry {
55
+ key: string;
56
+ /** Template text used when no locale resource provides a value. */
57
+ defaultText: string;
58
+ /**
59
+ * Synchronization policy when the key is missing from a locale file:
60
+ * `add` writes the default text, `report` only lists it. Default: `report`.
61
+ */
62
+ policy?: 'add' | 'report';
63
+ /** Owning feature note surfaced in the extraction report. */
64
+ description?: string;
65
+ }
66
+ export type MissingTranslationPolicy = {
67
+ mode: 'key';
68
+ } | {
69
+ mode: 'placeholder';
70
+ text: string;
71
+ };
72
+ export type InvalidFormatPolicy = {
73
+ mode: 'placeholder';
74
+ text: string;
75
+ } | {
76
+ mode: 'error';
77
+ };
78
+ /** App-injected persistence contract. The package never bundles a backend. */
79
+ export interface LocaleStorageAdapter {
80
+ getItem(key: string): Promise<string | null>;
81
+ setItem(key: string, value: string): Promise<void>;
82
+ removeItem(key: string): Promise<void>;
83
+ /**
84
+ * A synchronous read, for a store that has one (MMKV, rn-core's `KeyValuePort`).
85
+ * With it, `initSync()` resolves the locale before the first render, so the app
86
+ * never paints a frame in the wrong language (PERF-08).
87
+ */
88
+ getItemSync?(key: string): string | null;
89
+ }
90
+ /** Returns the device locale, or undefined when detection is unavailable. */
91
+ export type DeviceLocaleProvider = () => string | undefined;
92
+ export interface I18nConfig {
93
+ locales: LocaleConfig[];
94
+ /** Recovery locale when persistence or device detection cannot decide. */
95
+ primaryLocale: string;
96
+ resources: TranslationResources;
97
+ runtimeEntries?: RuntimeTranslationEntry[];
98
+ /** Persist the selected locale across launches. Default: true. */
99
+ persistLocale?: boolean;
100
+ /** Required when `persistLocale` is not disabled. */
101
+ storage?: LocaleStorageAdapter;
102
+ /**
103
+ * Receives every diagnostic: missing translations and variables, fallbacks,
104
+ * invalid formats, persistence failures. Defaults to `console.warn` in
105
+ * development builds only. Diagnostics also reach rn-core's SDK sinks.
106
+ */
107
+ onDiagnostic?: I18nDiagnosticHandler;
108
+ deviceLocale?: DeviceLocaleProvider;
109
+ /** Default: `{ mode: 'key' }`. */
110
+ missingTranslation?: MissingTranslationPolicy;
111
+ /** Default: `{ mode: 'placeholder', text: '—' }`. */
112
+ invalidFormat?: InvalidFormatPolicy;
113
+ }
114
+ export type LocaleSelectionSource = 'persisted' | 'device' | 'languageMatch' | 'primaryFallback' | 'runtimeSwitch';
115
+ export interface ActiveLocalePreference {
116
+ code: string;
117
+ source: LocaleSelectionSource;
118
+ /** True when an unsupported persisted locale was discarded. */
119
+ recovered: boolean;
120
+ }
121
+ export type TranslateVars = Record<string, string | number>;
122
+ export interface TranslateOptions {
123
+ /** Selects the plural variant and is exposed as the `count` variable. */
124
+ count?: number;
125
+ }
126
+ export { I18nConfigError } from './errors.js';
127
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/config/types.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,8 @@
1
+ import type { I18nConfig } from './types.js';
2
+ /**
3
+ * Validates an I18nConfig before any localized content is served (FR-003,
4
+ * FR-046). Collects every violation and throws a single I18nConfigError so
5
+ * apps see the complete picture instead of fixing issues one at a time.
6
+ */
7
+ export declare function validateConfig(config: I18nConfig, knownUnits: ReadonlySet<string>): void;
8
+ //# sourceMappingURL=validateConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateConfig.d.ts","sourceRoot":"","sources":["../../../../src/config/validateConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAgB,MAAM,YAAS,CAAC;AAGxD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,CA0DxF"}
@@ -0,0 +1,12 @@
1
+ import type { InvalidFormatPolicy } from '../config/types.js';
2
+ /**
3
+ * Locale-aware currency formatting. The locale's configured default currency
4
+ * applies unless the caller passes an explicit currency override (FR-021).
5
+ *
6
+ * `locale.defaultNumberFormat` is deliberately **not** applied here: a currency
7
+ * carries its own minor units (yen has none, dinar has three), and the locale's
8
+ * generic number options would override them — ¥1,234.56 instead of ¥1,235.
9
+ * Pass the options you want for a currency explicitly (I18N-09).
10
+ */
11
+ export declare function formatCurrencyValue(value: number, localeCode: string, defaultCurrency: string, currencyOverride: string | undefined, options: Intl.NumberFormatOptions | undefined, invalidFormat: InvalidFormatPolicy): string;
12
+ //# sourceMappingURL=currency.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"currency.d.ts","sourceRoot":"","sources":["../../../../src/format/currency.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAiB,CAAC;AAG3D;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,MAAM,EACvB,gBAAgB,EAAE,MAAM,GAAG,SAAS,EACpC,OAAO,EAAE,IAAI,CAAC,mBAAmB,GAAG,SAAS,EAC7C,aAAa,EAAE,mBAAmB,GAChC,MAAM,CAkBR"}
@@ -0,0 +1,14 @@
1
+ import type { InvalidFormatPolicy } from '../config/types.js';
2
+ /**
3
+ * Locale-aware date formatting through the Hermes built-in
4
+ * Intl.DateTimeFormat.
5
+ *
6
+ * Options are **merged** over the locale's configured default, the way
7
+ * `formatNumber` has always worked: `{ month: 'long' }` changes the month and
8
+ * keeps the year and day. Replacing the default wholesale, which this used to
9
+ * do, meant one option silently dropped every other component — and the two
10
+ * formatters disagreed about what an option meant (I18N-09). Pass
11
+ * `{ replaceDefaults: true }` for the old behaviour.
12
+ */
13
+ export declare function formatDateValue(value: Date | number, localeCode: string, defaults: Intl.DateTimeFormatOptions, override: Intl.DateTimeFormatOptions | undefined, invalidFormat: InvalidFormatPolicy, replaceDefaults?: boolean): string;
14
+ //# sourceMappingURL=date.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../../../src/format/date.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAiB,CAAC;AAG3D;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC9B,KAAK,EAAE,IAAI,GAAG,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,IAAI,CAAC,qBAAqB,EACpC,QAAQ,EAAE,IAAI,CAAC,qBAAqB,GAAG,SAAS,EAChD,aAAa,EAAE,mBAAmB,EAClC,eAAe,UAAQ,GACrB,MAAM,CAeR"}
@@ -0,0 +1,12 @@
1
+ import { type I18nDiagnosticHandler } from '../config/diagnostics.js';
2
+ import type { InvalidFormatPolicy } from '../config/types.js';
3
+ /** The policy as an i18n instance resolves it: with the instance's reporter. */
4
+ export type ResolvedInvalidFormatPolicy = InvalidFormatPolicy & {
5
+ readonly report?: I18nDiagnosticHandler | undefined;
6
+ };
7
+ /**
8
+ * Applies the configured invalid-format behavior: return the placeholder, or
9
+ * throw a clear formatting error in `error` mode (FR-037, FR-045).
10
+ */
11
+ export declare function applyInvalidFormatPolicy(policy: ResolvedInvalidFormatPolicy, message: string): string;
12
+ //# sourceMappingURL=invalid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid.d.ts","sourceRoot":"","sources":["../../../../src/format/invalid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,qBAAqB,EAAE,MAAM,0BAAuB,CAAC;AACpF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAiB,CAAC;AAE3D,gFAAgF;AAChF,MAAM,MAAM,2BAA2B,GAAG,mBAAmB,GAAG;IAC/D,QAAQ,CAAC,MAAM,CAAC,EAAE,qBAAqB,GAAG,SAAS,CAAC;CACpD,CAAC;AAEF;;;GAGG;AACH,wBAAgB,wBAAwB,CACvC,MAAM,EAAE,2BAA2B,EACnC,OAAO,EAAE,MAAM,GACb,MAAM,CAMR"}
@@ -0,0 +1,8 @@
1
+ import type { InvalidFormatPolicy } from '../config/types.js';
2
+ /**
3
+ * Locale-aware number formatting through the Hermes built-in
4
+ * Intl.NumberFormat. The locale default options apply unless the caller
5
+ * passes explicit overrides (FR-019).
6
+ */
7
+ export declare function formatNumberValue(value: number, localeCode: string, defaults: Intl.NumberFormatOptions, override: Intl.NumberFormatOptions | undefined, invalidFormat: InvalidFormatPolicy): string;
8
+ //# sourceMappingURL=number.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../../../src/format/number.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAiB,CAAC;AAG3D;;;;GAIG;AACH,wBAAgB,iBAAiB,CAChC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,IAAI,CAAC,mBAAmB,EAClC,QAAQ,EAAE,IAAI,CAAC,mBAAmB,GAAG,SAAS,EAC9C,aAAa,EAAE,mBAAmB,GAChC,MAAM,CAcR"}