@chipmobilesdk/rn-i18n 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@chipmobilesdk/rn-i18n",
3
- "version": "0.1.0",
4
- "private": false,
5
- "license": "UNLICENSED",
6
- "main": "src/index.ts",
3
+ "version": "0.1.1",
4
+ "private": false,
5
+ "license": "UNLICENSED",
6
+ "main": "src/index.ts",
7
7
  "types": "src/index.ts",
8
8
  "exports": {
9
9
  ".": {
@@ -26,6 +26,7 @@
26
26
  "src/format",
27
27
  "src/react",
28
28
  "src/tooling",
29
+ "skills",
29
30
  "README.md",
30
31
  "CHANGELOG.md"
31
32
  ],
@@ -41,8 +42,8 @@
41
42
  "engines": {
42
43
  "node": ">=22.11.0"
43
44
  },
44
- "publishConfig": {
45
- "access": "public",
46
- "registry": "https://registry.npmjs.org/"
47
- }
48
- }
45
+ "publishConfig": {
46
+ "access": "public",
47
+ "registry": "https://registry.npmjs.org/"
48
+ }
49
+ }
@@ -0,0 +1,62 @@
1
+ ---
2
+ name: sdk-rn-i18n
3
+ description: "Localization via @chipmobilesdk/rn-i18n: createI18n, useTranslation, useLocale, locale persistence, unit formatting, and the extraction/sync CLI. Use when adding translated strings, switching locale, formatting units, or syncing translation keys."
4
+ metadata:
5
+ package: "@chipmobilesdk/rn-i18n"
6
+ packageVersion: "0.1.0"
7
+ user-invocable: true
8
+ disable-model-invocation: false
9
+ ---
10
+
11
+ # @chipmobilesdk/rn-i18n
12
+
13
+ Localization with device-locale detection, persisted locale choice, typed translation
14
+ access, unit/number formatting, and a CLI that extracts and synchronizes keys.
15
+
16
+ ## Use this when
17
+
18
+ - Adding or changing any user-facing string
19
+ - Reading or switching the active locale
20
+ - Formatting numbers, dates or units for a locale
21
+ - Translation keys are missing, stale, or out of sync across locale files
22
+
23
+ ## Never hardcode a user-facing string
24
+
25
+ Every string rendered to a user goes through `useTranslation`. A literal in a component
26
+ is a defect — it cannot be translated and will not appear in extraction output.
27
+
28
+ ## Keys are generated, not hand-maintained
29
+
30
+ Do not hand-edit locale JSON to add a key. Run the extraction/sync CLI so every locale
31
+ file stays aligned. The monorepo exposes it as `npm run i18n:sync`. See
32
+ `## Extraction & synchronization CLI`.
33
+
34
+ ## Public API (v0.1.0)
35
+
36
+ Runtime:
37
+
38
+ - `createI18n(...)` → `I18n`
39
+ - `I18nProvider` (+ `I18nProviderProps`)
40
+ - `useTranslation()` → `UseTranslationResult`
41
+ - `useLocale()` → `UseLocaleResult`
42
+ - `defaultDeviceLocaleProvider` — device locale detection
43
+ - `LOCALE_STORAGE_KEY` — where the chosen locale persists
44
+ - `I18nConfigError` — thrown on invalid configuration at startup
45
+
46
+ Types: `I18n`, `UnitFormatOptions`, `I18nProviderProps`, `UseLocaleResult`,
47
+ `UseTranslationResult`
48
+
49
+ `I18nConfigError` throws at startup by design — a misconfigured i18n setup should fail
50
+ loudly, not silently render keys.
51
+
52
+ ## Where the detail lives
53
+
54
+ Read one section of `node_modules/@chipmobilesdk/rn-i18n/README.md`:
55
+
56
+ | Need | Section |
57
+ |---|---|
58
+ | First integration | `## Installation`, `## Quick start` |
59
+ | Full export list | `## Public API` |
60
+ | Locale file layout, plurals | `## Translations` |
61
+ | Adding/syncing keys | `## Extraction & synchronization CLI` |
62
+ | Version/peer constraints | `## Compatibility` |