Repository navigation
refactor(i18n): check that each key sits in its feature's part - #1685
Conversation
The i18n split moved every feature-only key into src/lib/i18n/<feature>.*.ts. i18n.test.ts now holds each part's files (PART_FILES) and fails when a part keeps a key another file also uses, or the base keeps a key only one part's files use; label-map keys count as used in their map's file. The four section comments the split left without entries go, and the conventions message and CONTRIBUTING.md name the part files.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 11 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
CodeRabbit did not review this PR (review limit reached). It changes no workflow, contract or auth code, so it merges on its required checks and this merge-pass review, per AGENTS.md. Merge-pass review (not move-only, so reviewed in full). The diff does what the body says.
Re-run on the PR head 5939d5b in a separate checkout:
Notes, not blocking:
|
The last PR of the i18n split (split plan, section 4 and the deferred items of section 2.4). The split PRs (#1673, #1674, #1676, #1677, #1679, #1680, #1681, #1683) moved every feature-only key into
src/lib/i18n/<feature>.{ko,ja,zh}.tsand were move-only. This PR carries the non-move changes the split left for the end. It is not move-only: it changes a test, a test message and CONTRIBUTING.md, so it takes the normal review path.Changes
Placement check (
src/lib/i18n.test.ts). A new test in "dictionary parts" fails when:Cancel (in palette, belongs in base);Enable notifications (in base, belongs in palette);KO_PARTShas a part thatPART_FILESdoes not list.PART_FILESlists each part's files, the same lists as the part headers. A key's uses are the files that callt()/tt()with it plus, for the 13 label maps, the map's own file. To support this,labelMapKeys()becomeslabelMapUses()and returns[key, file]pairs; the existing missing/unused test takes just the keys, so it checks the same set as before. File paths are normalized to/so the check also holds on Windows. OnlyKO_PARTSis checked, because the existing "same part in every language" test already ties JA and ZH to it.Emptied section comments.
// ---- key bar ----,// ---- markdown ----,// ---- install help ----and// ---- sign-in ----no longer have any entries in the base files (ko, ja, zh) and are removed.src/conventions.test.ts. The "New workspace" failure message now points tosrc/lib/i18n.*.ts or src/lib/i18n/*.ts.CONTRIBUTING.md. The UI text rule now saysbun run test:unitalso fails on an entry kept in the wrong file.Checks
HERDR_TEST_MODE=unit bun test src/lib/i18n.test.ts src/conventions.test.ts: 28 pass, 0 fail.Cancel (in palette, belongs in base);Enable notifications (in base, belongs in palette).KO,JAandZHare identical to main's (sorted-JSON dump diff empty,EQUIVALENT): only comment lines leave the dictionaries.bun run typecheck: passes.bun run check fast: passes (unit 6128 pass, 0 fail, 12 skip in 434 files, 8 at a time, 58.2s).No changelog fragment: users see no change.