Commit graph

1 commit

Author SHA1 Message Date
leessju
3944ef34b8
feat(scripts): add informational i18n coverage report (#1896)
Adds `scripts/i18n-coverage-report.ts` (wired via
`pnpm i18n:coverage`) that reports per-locale key-coverage drift
against English. The output looks like:

  Locale (key total = 1578 on en)
  en       English                keys=1578 missing=   0 ...
  zh-CN    简体中文                  keys=1578 missing=   0 coverage=100%
  th       ภาษาไทย               keys=1261 missing= 317 coverage=80%
  ...

Why this is useful right now:

- The existing `scripts/i18n-check.ts` validates *structural*
  consistency (locale registration, README switcher alignment, core
  doc link references) and exits non-zero on failure. It does not
  surface content-coverage drift.
- The test suite enforces strict English-parity only for Indonesian
  (`id`) — other locales pass CI even when an English key was added
  without a matching translation. Today the average locale is missing
  ~140–300 keys vs English on `main`.

This script is purely informational — exit code stays 0. It gives
contributors and release managers a fast way to see which locale
needs translation work without breaking PRs until the locale catches
up. Issue #1894 covers the policy question of *whether* strict
enforcement should extend beyond Indonesian (e.g., to a tier-1 locale
set); this script is the substrate for that policy conversation, not a
substitute for it.

Refs #1894.

Validation:
- `pnpm i18n:coverage` runs end-to-end against the 19 locale files
  under `apps/web/src/i18n/locales/`, exit 0.
- `pnpm guard` green.
- `pnpm exec tsc -p scripts/tsconfig.json --noEmit` green.

Co-authored-by: nicejames <nicejames@gmail.com>
2026-05-16 16:06:25 +08:00