Skip to content

refactor(i18n): move workspace and files-only strings into src/lib/i18n/ - #1680

Merged
devswha merged 1 commit into
mainfrom
refactor/i18n-workspace-files
Oct 22, 2026
Merged

devswha merged 1 commit into
mainfrom
refactor/i18n-workspace-files

Conversation

@devswha

@devswha devswha commented Oct 22, 2026

Copy link
Copy Markdown
Owner

Next PR of the i18n split (split plan, section 4). The strings that only the workspace and files files use (each feature into its own part) move out of the three base dictionaries into src/lib/i18n/workspace.{ko,ja,zh}.ts and src/lib/i18n/files.{ko,ja,zh}.ts. t(), the English keys, every translation, placeholders, the English fallback and all call sites stay the same.

What changes

  • workspace: 75 keys in each language, byte for byte, in the order each language's file had them. A key moves only when every file that uses it is one of: components/NewSessionDialog.tsx, components/WorktreeDialog.tsx, components/DirectoryBrowser.tsx, components/RecentFolderChips.tsx, components/SessionHistory.tsx, lib/sessionHistory.ts.
  • files: 89 keys in each language, byte for byte, in the order each language's file had them. A key moves only when every file that uses it is one of: components/FileViewer.tsx, components/FilesDialog.tsx, components/FileReader.tsx, components/TextFileView.tsx, components/FilePathLink.tsx, components/FilePanelResizer.tsx, components/HighlightedCode.tsx, components/RepoDiffViewer.tsx, components/RepoChanges.tsx, components/RepoDiff.tsx, lib/repoDiff.ts, components/WebPanel.tsx.
  • Composition: each base file gains 2 imports and 2 KO_PARTS / JA_PARTS / ZH_PARTS entries. 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, 773bc2b6 (keys collected as i18n.test.ts does: t()/tt() literals plus the 13 label maps, per file):

  • workspace: 75 keys, identical to the plan's list from 8b5aaba.
  • files: 89 keys, identical to the plan's list from 8b5aaba.

Checks

  • Same dictionaries: the composed KO, JA and ZH (every key and value) dumped as sorted JSON on 773bc2b6 and on this branch are byte-identical (EQUIVALENT).
  • --color-moved summary: git diff --color-moved=plain origin/main...HEAD over the base and part files: 1014 lines shown as moved. The non-moved lines are 66 added lines: imports, parts entries, and each part file's header, export const line and };. Every removed line is a moved entry. Nothing else is added or removed.
  • Same keys moved: each part's keys equal its regenerated list in ko, ja and zh (SAME-KEYS). The scan still finds all 1389 keys, the same count as main.
  • Sizes: i18n.ko.ts 673 -> 513, i18n.ja.ts 675 -> 515, i18n.zh.ts 677 -> 517 lines; each workspace part 83 lines, each files part 99 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, 58.5s).

Move-only: moved lines, imports, parts entries and part headers.

No changelog fragment: users see no change.

The 75 workspace and 89 files keys that only each feature's files use move, byte for byte, from
src/lib/i18n.{ko,ja,zh}.ts into src/lib/i18n/workspace.{ko,ja,zh}.ts and src/lib/i18n/files.{ko,ja,zh}.ts,
which each base dictionary imports and lists in its parts. KO, JA, ZH, t() and
every call site are unchanged.
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between 773bc2b and cedfd23.

📒 Files selected for processing: 9
  • src/lib/i18n.ja.ts
  • src/lib/i18n.ko.ts
  • src/lib/i18n.zh.ts
  • src/lib/i18n/files.ja.ts
  • src/lib/i18n/files.ko.ts
  • src/lib/i18n/files.zh.ts
  • src/lib/i18n/workspace.ja.ts
  • src/lib/i18n/workspace.ko.ts
  • src/lib/i18n/workspace.zh.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Localization
    • Updated Japanese, Korean, and Simplified Chinese translations across workspace and file-related screens.
    • Localized text covers workspace setup, sessions, folders, file browsing and previews, diffs, and related errors.
    • Added translated labels and messages while preserving dynamic values shown in the interface.

Japanese, Korean, and Simplified Chinese translations are split into workspace and files dictionaries. The locale modules import and register these dictionaries, while removing many of their entries from the base dictionaries.

Changes: Japanese, Korean, and Chinese localization

Layer / File(s) Summary
Workspace and files dictionaries
src/lib/i18n/{workspace,files}.{ja,ko,zh}.ts
New dictionaries provide translated workspace, file-viewing, change, diff, and folder-browsing text. Dynamic placeholders are retained in translated messages.
Base dictionaries and locale registration
src/lib/i18n.{ja,ko,zh}.ts
The locale modules register the new dictionaries and remove many corresponding entries from their base dictionaries. Selected file, folder, error, and diff-layout labels remain or are added.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to cedfd

The translation split preserves the displayed text and placeholders in all three languages. No issue identified here needs to be resolved before merging.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly describes the main change: moving workspace-only and files-only translation strings into separate i18n files.
Description check Passed The description explains the change, scope, ownership rules, compatibility guarantees, and validation results. It uses "What changes" and "Checks" instead of the template headings "Change" and "Valida…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 9…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the change, scope, ownership rules, compatibility guarantees, and validation results. It uses "What changes" and "Checks" instead of the template headings "Change" and "Validation", but it provides the required information.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 9 files.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devswha

devswha commented Oct 22, 2026

Copy link
Copy Markdown
Owner Author

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 cedfd23, in a separate checkout:

  • Equivalence: the composed KO/JA/ZH dumped as sorted JSON (i18n-dump.ts) are byte-identical to the merge base: EQUIVALENT.
  • Moved diff: git diff --color-moved=plain origin/main...HEAD shows every removed key line as a move. The only non-moved lines are the part imports, the parts entries and the part file headers.
  • i18n tests: HERDR_TEST_MODE=unit bun test src/lib/i18n.test.ts pass.

Files: src/lib/i18n.ja.ts src/lib/i18n.ko.ts src/lib/i18n.zh.ts src/lib/i18n/files.ja.ts src/lib/i18n/files.ko.ts src/lib/i18n/files.zh.ts src/lib/i18n/workspace.ja.ts src/lib/i18n/workspace.ko.ts src/lib/i18n/workspace.zh.ts

@devswha
devswha merged commit b6085f1 into main Oct 22, 2026
9 checks passed
@devswha
devswha deleted the refactor/i18n-workspace-files branch October 22, 2026 20:28
devswha added a commit that referenced this pull request Oct 22, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant