Repository navigation
refactor(i18n): move composer-only strings into src/lib/i18n/ - #1676
Conversation
The 127 composer keys that only the composer files use move, byte for byte, from
src/lib/i18n.{ko,ja,zh}.ts into src/lib/i18n/composer.{ko,ja,zh}.ts,
which each base dictionary imports and lists in its parts. KO, JA, ZH, t() and
every call site are unchanged.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Merge Risk: ⚪ Minimal · up to
|
|
Move-only PR, merged on its required checks without waiting for CodeRabbit (AGENTS.md: a move-only PR merges once its diff shows only moved code and imports). Merge-gate check on the PR head 0429973, in a separate checkout:
Files: src/lib/i18n.ja.ts src/lib/i18n.ko.ts src/lib/i18n.zh.ts src/lib/i18n/composer.ja.ts src/lib/i18n/composer.ko.ts src/lib/i18n/composer.zh.ts |
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}.ts` and 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: - a part keeps a key that a file outside the part also uses, reported as `Cancel (in palette, belongs in base)`; - the base keeps a key that only one part's files use, reported as `Enable notifications (in base, belongs in palette)`; - `KO_PARTS` has a part that `PART_FILES` does not list. `PART_FILES` lists each part's files, the same lists as the part headers. A key's uses are the files that call `t()`/`tt()` with it plus, for the 13 label maps, the map's own file. To support this, `labelMapKeys()` becomes `labelMapUses()` 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. Only `KO_PARTS` is 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 to `src/lib/i18n.*.ts or src/lib/i18n/*.ts`. - **`CONTRIBUTING.md`.** The UI text rule now says `bun run test:unit` also 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. - The placement test was checked by breaking it on purpose, in all three languages, then restoring the files: - moving the shared key "Cancel" from the base into the palette part fails with `Cancel (in palette, belongs in base)`; - moving a palette-only key into the base fails with `Enable notifications (in base, belongs in palette)`. - The composed `KO`, `JA` and `ZH` are 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.
Next PR of the i18n split (split plan, section 4). The strings that only the composer files use move out of the three base dictionaries into
src/lib/i18n/composer.{ko,ja,zh}.ts.t(), the English keys, every translation, placeholders, the English fallback and all call sites stay the same.What changes
components/Composer.tsx(with SOURCE_LABEL),components/ComposerNotices.tsx,components/VoiceInput.tsx,components/SecretInput.tsx,components/TerminalInput.tsx,components/PendingMessages.tsx,lib/compose.ts,components/PromptCard.tsx,lib/promptAnswer.ts.KO_PARTS/JA_PARTS/ZH_PARTSentry. Nothing else in the base files changes; no test or docs change.Key list
Regenerated with the split plan's ownership script on this branch's base,
601eb3ab(keys collected asi18n.test.tsdoes:t()/tt()literals plus the 13 label maps, per file):Checks
KO,JAandZH(every key and value) dumped as sorted JSON on601eb3aband on this branch are byte-identical (EQUIVALENT).--color-movedsummary:git diff --color-moved=plain origin/main...HEADover the base and part files: 816 lines shown as moved. The non-moved lines are 33 added lines: imports, parts entries, and each part file's header,export constline and};. Every removed line is a moved entry. Nothing else is added or removed.SAME-KEYS). The scan still finds all 1389 keys, the same count as main.i18n.ko.ts1069 -> 944,i18n.ja.ts1071 -> 946,i18n.zh.ts1073 -> 948 lines; eachcomposerpart 136 lines (cap 400).HERDR_TEST_MODE=unit bun test src/lib/i18n.test.ts: 21 pass, 0 fail.bun run typecheck: passes.bun run check fast: passes (unit 6127 pass, 0 fail, 12 skip in 434 files, 8 at a time, 76.9s).Move-only: moved lines, imports, parts entries and part headers.
No changelog fragment: users see no change.