Repository navigation
refactor(i18n): move terminal-only strings into src/lib/i18n/terminal.*.ts - #1674
Conversation
….*.ts
The 113 keys that only the terminal's files use (PaneTerminal, PaneCanvas, KeyBar,
FindBar, TerminalViewportTools, SplitDropPreview, TabStrip, terminalLabel, tabName)
move, byte for byte, from src/lib/i18n.{ko,ja,zh}.ts into
src/lib/i18n/terminal.{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-pass check on the PR head 6f994e0, in a separate checkout:
The emptied |
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.
Second PR of the i18n split (#2 in the split plan, after the Settings pilot #1673). The strings that only the terminal's files use move out of the three base dictionaries into
src/lib/i18n/terminal.{ko,ja,zh}.ts.t(), the English keys, every translation, placeholders, the English fallback and all call sites stay the same.What changes
components/PaneTerminal.tsx,components/PaneCanvas.tsx,components/KeyBar.tsx(with itsARROWSandKEY_SPOKEN_NAMESlabel maps),components/FindBar.tsx,components/TerminalViewportTools.tsx,components/SplitDropPreview.tsx,components/TabStrip.tsx,lib/terminalLabel.tsandlib/tabName.ts. Keys these files share with another feature stay in the base files.KO_PARTS/JA_PARTS/ZH_PARTSentry (terminal: TERMINAL_KO, …). Nothing else in the base files changes.Key list
I regenerated the list with the split plan's ownership script on this branch's base,
a717621f. That script collects keys the same way asi18n.test.ts:t()/tt()literals plus the 13 label maps, recorded per file. It finds 113 terminal keys, identical to the plan's list from8b5aaba2, with no key added or removed. Since then main gained only #1672 (no i18n change) and the pilot #1673 (which moved only Settings-only keys).Checks
Same dictionaries: the composed
KO,JAandZH(every key and value) dumped as sorted JSON ona717621fand on this branch are byte-identical (EQUIVALENT).--color-movedsummary:git diff --color-moved=plain origin/main...HEADover the base and part files shows all 339 removed entry lines (113 × 3) as moved. The only non-moved lines are 33 added lines, 11 per language:export constline and its closing};.No line is removed other than moved entries.
Same keys moved: the keys of
TERMINAL_KO,TERMINAL_JAandTERMINAL_ZHeach equal the 113-key list (SAME-KEYSfor ko, ja and zh). The scan still finds all 1,389 keys, the same count as main.Part sizes: each part file is 122 lines, under the 400-line cap.
i18n.ko.tsgoes from 1,180 to 1,069 lines,i18n.ja.tsfrom 1,182 to 1,071 andi18n.zh.tsfrom 1,184 to 1,073.HERDR_TEST_MODE=unit bun test src/lib/i18n.test.ts: 21 pass, 0 fail. This covers missing, unused, placeholder and untranslated entries, a key in two parts, and different placement across languages.bun run typecheck: passes.bun run check fast: passes (unit 6127 pass, 0 fail, 12 skip; workflow syntax, generated types/themes, typecheck and build ok).This PR contains only moved lines, one import and one parts entry per language, and the part file header. It should qualify for the move-only merge path if the parts entry and header are counted as part of the move.
Note
After this move the
// ---- key bar ----section comment in each base file has no entries left: its keys went to Settings (#1673) and here. The comment is left in place to keep this diff move-only; the last split PR can drop empty section comments.No changelog fragment: users see no change.