feat(desktop): add i18n with zh-CN translations - #37276
Closed
falser101 wants to merge 1 commit into
Closed
Conversation
Author
falser101
force-pushed
the
feat/i18n-zh-cn-settings
branch
from
June 4, 2026 01:22
0208dba to
ad5e87b
Compare
falser101
force-pushed
the
feat/i18n-zh-cn-settings
branch
from
June 4, 2026 02:16
ad5e87b to
fabca0b
Compare
Introduce i18next + react-i18next in the desktop renderer with a flat-key translation resource under src/locales/ (en + zh-CN), a parity test, and a contributor guide. Translate the entire settings surface (nav, Appearance, Gateway, API Keys, MCP, Skills & Tools, Archived Chats, About, Config schema) to use t() lookups. Add a language picker in Appearance that persists the choice to localStorage. Future languages drop a new src/locales/<lang>/translation.json with the same key set, register it in src/lib/i18n.ts, and add a button in the language picker.
falser101
force-pushed
the
feat/i18n-zh-cn-settings
branch
from
June 4, 2026 02:56
ad5e87b to
a8619bf
Compare
Author
|
@alt-glitch Please review this, and then we can submit more PRs. |
Contributor
|
Superseded by #38241, which we merged as the desktop i18n foundation + Simplified Chinese translation. It aligns with our existing web/src/i18n pattern (typed Translations, I18nProvider/useI18n, display.language config key), was already green across CI, and merged cleanly. Thanks for the work on localization — this is exactly the direction we wanted, and your effort helped confirm it. #38241 |
This was referenced Jun 15, 2026
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
Introduce i18next + react-i18next in the desktop renderer and ship a Simplified Chinese (zh-CN) translation of the entire settings panel. The infrastructure is set up so that future languages can be contributed by dropping in a single JSON file.
What's in this PR
i18n infrastructure (
src/lib/i18n.ts,src/types/i18next.d.ts,src/main.tsx)codeSplitting: falseso they all bundle; the two locales are ~30KB combined)localStorage['hermes-desktop-locale-v1']→navigator.language→'en'nsSeparator: false+keySeparator: falseso flatnamespace:section.subsectionkeys match literallyreturnNull: falseso missing keys fall back to the key string (visible in dev)Translation resources (
src/locales/)en/translation.json— English sourcezh-CN/translation.json— Simplified Chinese, parity-locked with EnglishREADME.md— contributor guide (how to add a new language)locales.test.ts— vitest parity test: same key set, all leaf values are strings,{{var}}placeholder tokens match between locales. Fails CI if a key drifts.Language picker (
src/app/settings/appearance-settings.tsx)aria-pressed; choice persists tolocalStoragesrc/lib/i18n.ts→ add a buttonTranslated surface (8 sub-pages, 1 main panel, 1 constants file, 1 primitives file)
index.tsx(nav, search placeholders, header buttons)appearance-settings.tsx(mode/theme cards, tool-call display, language picker)gateway-settings.tsx(mode cards, remote URL/token, save/test buttons, env-override warning)keys-settings.tsx(LLM provider groups, env-var rows, show-advanced toggle)mcp-settings.tsx(server list, edit form, transport labels, reload flow)sessions-settings.tsx(archived sessions list, unarchive/delete actions)tools-settings.tsx(skills + toolsets, toggle/save toasts)toolset-config-panel.tsx(provider selection, env-var inline editor, post-setup notice)config-settings.tsx(schema-driven form, field labels/descriptions, import, autosave)about-settings.tsx(update status, version, branch info, relative time)constants.ts—FIELD_LABELS/FIELD_DESCRIPTIONS/SECTIONS/SEARCH_PLACEHOLDERnow hold i18n key stringsprimitives.tsx— shared<SectionHeading>/<EmptyState>/<LoadingState>/<Pill>default labels translatedDesign choices
:separator (e.g.settings:mcp.configured) instead of nested objects. Grep-friendly and matches the convention we use everywhere else.nsSeparator: false+keySeparator: falseare required to make literal matching work.i18next-http-backend. Two languages don't justify the dynamic-loader complexity, and Vite bundles them into the main chunk anyway.en/, translate, run the parity test". A failed test blocks the PR.Out of scope
apps/agent/locales/*.yaml— separate i18n layer)Intl.DateTimeFormat/Intl.NumberFormatlocalizationVerification
Manual:
npm run devxxx.xxx)Adding a new language
See
src/locales/README.md. TL;DR: copyen/translation.json, translate, add an entry insrc/lib/i18n.ts'sSUPPORTED_LANGUAGESandresources, add a button in the language picker.