open-design/apps/web/tests/i18n
Renfei e3e990fce3
test(i18n): lock zh-CN to tier-1 explicit translation parity (#2920)
Refs #1894.

The existing locale-shape test (`Object.keys(dict).sort() === englishKeys`)
passes for every locale today, but most modules satisfy it via `...en`
spread — so an English key added without a matching translation falls
back to English at runtime, the test still passes, and locale drift
accumulates silently.

`zh-CN.ts` is the one locale today that declares all 2302 keys
explicitly, with no `...en` spread. This change pins that property as
a regression test:

- New: `keeps zh-CN explicitly translated for every English key (tier-1
  parity lock)` — asserts the `'key':` literals in the source file
  match the full English key set, using the existing
  `explicitLocaleKeys` helper.
- New: `keeps the zh-CN locale source free of the `...en` spread
  fallback` — paired source-grep guard so a future refactor can't sneak
  the spread back in.

Both cases pass today without any locale-content edits (verified
locally against `main` at the time of writing: 2302 explicit keys,
no `...en` match). Net effect: a future PR that adds an English key
must update `zh-CN` synchronously or CI fails loudly for this one
locale, instead of letting the gap widen in silence.

Scope kept deliberately narrow per the discussion on #1894 — this
does not touch `id.ts` (which currently uses `...en`), does not change
the wider policy decision (enforce all locales / tier-1 subset /
report-only), and does not duplicate the `pnpm i18n:coverage` report
that shipped in #1896. It just locks `zh-CN`'s current tier-1 state
so the rest of the policy discussion can proceed without losing that
ground.

Co-authored-by: zhongrenfei1-hub <231221504+zhongrenfei1-hub@users.noreply.github.com>
2026-05-25 20:08:41 +08:00
..
content.test.ts Add i18n metadata for official content (#2692) 2026-05-22 16:39:32 +08:00
design-files-agent-copy.test.ts feat(i18n): add Indonesian locale 2026-05-07 16:48:05 +08:00
design-files-dropzone-copy.test.ts feat(i18n): add Indonesian locale 2026-05-07 16:48:05 +08:00
detect-initial-locale.test.ts feat(desktop): follow OS language in packaged builds (cherry-pick of #2544 into release/v0.8.0) (#2560) 2026-05-21 18:23:20 +08:00
locales.test.ts test(i18n): lock zh-CN to tier-1 explicit translation parity (#2920) 2026-05-25 20:08:41 +08:00