Shared Locale CLI Utilities
Shared utilities live in apps/web/scripts/locales/shared/.
Files
ansi.ts— common CLI colors/stylesbanner.ts— reusable boxed locale banner printercode.ts— locale code normalize/validate/list helperslocaleLeaf.ts— structured non-English leaf types (value,status,confidence,needsReview,source,updatedAt), sync merge helpers, and locale tree walking for parity/review/cleanupreference.ts— central English source locale guard (en) for all locale CLIsprompts.ts— shared prompt helpers (isExitPromptError, hint printer)preserve.ts— EN-value comparison exclusions for sync parity + fill mode + generate copy-as-is preserve rules
Why split preserve policy
Two preserve concerns are different but are implemented in one file:
- Copy preserve (
COPY_EN_VERBATIM_KEYS): what generation keeps exactly from English. - Compare preserve (
EXCLUDE_EN_COMPARE_*): what parity/fill ignores during EN-identical comparison.
This avoids coupling translation behavior with parity diagnostics.
English safety guard
shared/reference.ts centralizes the English source locale guard:
- the reference locale slug/file (
en,en.json) - guard helpers to prevent accidental deletion/cleanup of English
Delete/Cleanup CLIs use this guard so en.json is always protected.