Repository navigation
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
I opened a version of this earlier and the bot closed it as a duplicate of this PR, which was the right call. Two of the three changes I had made are worth having here, and I would rather not open a competing PR for them. The missing-key baseline will not survive contact with the codebase. Item 3 in the issue asks for a count that never rises above a constant (app 418, ui 51). English gains keys with every feature PR, so a fixed number fails on the next English string added, and it also fails on the two translation PRs currently open (#51708, #53174) whenever a locale gains a key before English does. A ratio survives that: each locale keeps at least 80% of the English key count. The least complete locale on Checking every locale is barely more work than checking two. The loop over locales already exists for the baseline; running placeholder and subset checks across all 62 app locales and 61 ui locales instead of only zh and zht costs the same traversal. Today both packages report zero placeholder mismatches, so a wider check passes rather than finding work. Item 4 does hold right now. zh and zht carry identical key sets in both packages, 858 keys each in the app package and 248 in ui, so the assertion can be added as written. One blocker is separate and needs a small PR before the subset assertion can pass: 19 app locale dictionaries still define four key families English dropped, Happy to test or rebase anything here if that is easier than rewriting it. |
Issue for this PR
Closes #50772
Type of change
What does this PR do?
V2 has no guard against locale dictionary drift: a bad placeholder, a stray key, or a dropped translation lands silently (English fallback hides it). This adds two test files:
packages/app/src/runtime/i18n/parity.test.tspackages/ui/src/i18n/parity.test.tsEach asserts that translated dicts stay aligned with
en: identical{{param}}sets per key, no unknown keys,zh/zhtkey parity with each other, and a "missing keys must not grow" baseline (app 418, ui 51 as of today — the constant has a comment saying it should only ever go down). Deliberately not a strict 100% parity assert, since partial locales with English fallback are the intended V2 design.How did you verify your code works?
cd packages/app && bun run test:unit→ 906 pass, 0 fail (new file included in the run)cd packages/ui && bun test src→ 120 pass, 0 failScreenshots / recordings
Not a UI change — no screenshots needed.
Checklist