@courthive/i18n 0.4.8 → 0.5.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.
package/README.md CHANGED
@@ -21,6 +21,10 @@ src/
21
21
  zh-CN.json
22
22
  scripts/
23
23
  compare-keys.cjs # CI gate: fails on key drift / duplicate keys
24
+ merge-source-en.cjs # Merges a consumer's en.json in; seeds __TODO__ / __STALE__
25
+ copy-locales.cjs # src -> dist; drops __TODO__, unwraps __STALE__
26
+ check-dist-no-todo.cjs # Build gate: no sentinel may reach dist
27
+ todo-report.cjs # Backlog report consumed by i18n-todo-reminder
24
28
  install-husky-hooks.cjs # Copies scripts/husky/* into .husky/ on prepare
25
29
  husky/
26
30
  pre-commit # Hook body (lint + check-types + compare-keys)
@@ -37,9 +41,31 @@ scripts/
37
41
  completeness, RTL flag) used by CFS to serve `GET /i18n/manifest`.
38
42
  - `dist/index.js` + `.d.ts` — re-exports the manifest type and labels.
39
43
 
40
- `completeness = 1 - (__TODO__ count / total keys)`. New keys land as
41
- `__TODO__` placeholders in non-English locales; translators fill them
42
- in and merge a follow-up PR that brings completeness back to 1.0.
44
+ ## The two translator sentinels
45
+
46
+ `completeness = 1 - ((__TODO__ + __STALE__ count) / total keys)`, measured
47
+ against `src` — the only tree where the sentinels still exist.
48
+
49
+ | sentinel | means | shape in `src` | what `dist` ships | what the user sees |
50
+ | ----------- | ------------------------------------------------------------------ | -------------------------------------- | ------------------------------------- | ---------------------------------- |
51
+ | `__TODO__` | no translation yet | replaces the value | key **dropped** | English (i18next per-key fallback) |
52
+ | `__STALE__` | a translation exists, but the English it was made from has changed | **prefix** on the retained translation | prefix **stripped**, translation kept | the old translation |
53
+
54
+ `merge-source-en.cjs` seeds both: `__TODO__` for keys the source adds,
55
+ `__STALE__` for keys whose English value changes under an existing
56
+ translation. Translators fill in / confirm them and merge a follow-up PR
57
+ that brings completeness back to 1.0.
58
+
59
+ `__STALE__` is deliberately a _prefix_, not a replacement value. Replacing
60
+ the value and dropping it like `__TODO__` would make the key **absent**, and
61
+ an absent key falls back to English — so a copy edit in English would
62
+ silently un-translate the string for every non-English user. Keeping the
63
+ translation on screen while the metric counts it as debt is the trade.
64
+
65
+ Neither sentinel may reach `dist`: `check-dist-no-todo.cjs` fails the build
66
+ on either. A shipped `__TODO__` renders literally (this was live in
67
+ production on 2026-08-16 — a French TD read `__TODO__` in the schedule UI);
68
+ a shipped `__STALE__` would prepend the marker to a real translation.
43
69
 
44
70
  ## Scripts
45
71