feat: add i18n infrastructure with Chinese (Simplified) translation - #84
Open
lunaship wants to merge 2 commits into
Open
feat: add i18n infrastructure with Chinese (Simplified) translation#84lunaship wants to merge 2 commits into
lunaship wants to merge 2 commits into
Conversation
- Add lightweight i18n module (src/lib/i18n.ts) with t(), tNamed(),
tPlural(), and pluralKey() APIs - zero external dependencies
- Add English locale template (src/lib/locales/en.ts) as reference
- Add Chinese Simplified locale (src/lib/locales/zh-CN.ts) with 986
translated strings covering all UI components
- Add unit tests for i18n module (src/lib/i18n.test.ts)
- Replace hardcoded English strings with t() calls across ~110 files,
including model settings catalogs and transcript tool-title fallbacks
- Import bootLocale first in main.tsx so setLocale("zh-CN") runs before
module-evaluation-time t() calls; models.ts and harness catalogs
otherwise froze English labels
- Localize the native macOS menu bar to Chinese (labels only; dispatch
matches on item IDs)
- Add README.zh-CN.md with a language switcher; upstream docs stay in
English
- Use lazy-evaluated functions (getSettingsSections, getKeybindings,
getHarnessTitle, getRuntimeModeLabel/Hint) to ensure translations
apply correctly at render time
- Default locale is 'en' (identity mapping) for backward compatibility
Translation scope: all user-visible UI strings including sidebar,
title bar, composer, settings, file tree, git panel, inbox, notes,
search, terminal, diff views, dialogs, and error messages.
Not translated: LLM prompt strings (sent to AI models, not shown to
users), brand names (MonoCode, Claude, GitHub, Linear), and technical
identifiers.
lunaship
force-pushed
the
feat/i18n-zh-CN
branch
from
September 6, 2026 09:20
c62f479 to
0b7f093
Compare
…olding Resolves conflicts with 64fb6d3..2bc69af and extends zh-CN coverage to the new surfaces: - menu bar and settings zoom items (放大/缩小/重置缩放) - notifications settings row and window-close confirmation - transcript work summaries (editing/reading/running…) via t() - native notification "Show" action buttons (显示) - fix hardcoded English "for" in the working-duration template Locales now 1021 keys, en/zh aligned; tsc, vitest (1284), cargo (fmt/clippy/test) and the Tauri build all pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds internationalization (i18n) support with a complete Chinese (Simplified) translation. The i18n system is lightweight (zero dependencies) and designed for easy extension to other languages.
What's included
i18n infrastructure
src/lib/i18n.ts— Core module witht(),tNamed(),tPlural(),pluralKey()APIssrc/lib/bootLocale.ts— sets the app locale; imported FIRST inmain.tsxso module-evaluation-timet()calls (model catalogs) translate correctlysrc/lib/i18n.test.ts— Unit tests (8 tests, all passing)src/lib/locales/en.ts— English locale template (1021 keys, identity mapping)src/lib/locales/zh-CN.ts— Chinese Simplified translation (1021 entries, key sets aligned)Translation coverage
t()callst()README.zh-CN.md, linked from the top of the English README; upstream docs stay in EnglishDesign decisions
zh-CNviabootLocale.ts, imported before any module that callst()at evaluation timegetSettingsSections(),getKeybindings(),getHarnessTitle()ensure translations apply correctly at render timeHow to add a new language
src/lib/locales/xx.tsmapping English keys to translated stringssrc/lib/i18n.tssetLocale("xx")at app startupTesting
Screenshots
The translation covers all settings sections, sidebar, composer, and every user-facing string in the app.