Skip to content

feat(desktop): add i18n with system language support - #5152

Open
wusuoweiju48 wants to merge 2 commits into
block:mainfrom
wusuoweiju48:codex/i18n-system-language-followup
Open

feat(desktop): add i18n with system language support#5152
wusuoweiju48 wants to merge 2 commits into
block:mainfrom
wusuoweiju48:codex/i18n-system-language-followup

Conversation

@wusuoweiju48

Copy link
Copy Markdown

Summary

This PR adds desktop i18n infrastructure and a Language setting, then extends it with robust system-language behavior.

It intentionally includes and supersedes #5087. The original commit from @HyperfocuSam is preserved unchanged, retaining its authorship and DCO sign-off.

  • Wire react-i18next into the desktop app with English fallback.
  • Add en, zh-Hans, and zh-Hant locale resources and a bounded first extraction across high-traffic desktop surfaces.
  • Add a system language preference and use it by default when no explicit preference is stored.
  • Resolve supported system locales across Simplified and Traditional Chinese variants, including Hong Kong, Macau, Singapore, and Malaysia.
  • Preserve existing stored preferences while failing safely when browser storage is unavailable.
  • Keep the selector synchronized when switching back to the system language does not change the effective locale.
  • Add locale-key and interpolation-variable parity tests.
  • Fix the Voice settings descriptor to use labelKey and add its missing strings to all three locales.

Related issue

Testing

  • pnpm typecheck
  • pnpm test — 4,403 passed, 0 failed
  • pnpm exec biome check on all changed TypeScript, test, and locale files
  • pnpm build
  • pnpm check:file-sizes
  • pnpm check:px-text
  • pnpm check:pubkey-truncation

Manual verification

  1. Open Settings → Appearance → Language.
  2. Verify Follow system, English, Traditional Chinese, and Simplified Chinese are available.
  3. With a Simplified Chinese system locale, choose Follow system and verify the UI resolves to Simplified Chinese.
  4. Choose Simplified Chinese explicitly, reload, and verify the explicit preference persists.

Screenshots

Follow system

language-settings-system

Simplified Chinese

language-settings-zh-hans

Sam Wong and others added 2 commits August 6, 2026 10:35
…#2929)

Wires react-i18next into the desktop app with `en` as default and fallback,
adds a Language selector in Settings persisted through the existing settings
mechanism, and extracts a bounded first slice of 140 keys across four
high-traffic surfaces (Settings, sidebar, composer/message actions, agents).

Everything not yet extracted stays hardcoded and renders in English, so no
surface regresses while extraction continues surface by surface. A big-bang
pass over all ~520 desktop `.tsx` files would not be reviewable.

`desktop/src/locales/STRINGS-MANIFEST.md` lists every key with its English
source and one line of UI context, so a human translator can work without
reading the code.

Empty locale values fall back to English (`returnEmptyString: false`), so a
locale can land partially translated and ship the rest later. Machine
translation is deliberately not a build step — translation quality stays a
human decision per locale.

`AppSidebar.tsx` and `MessageComposer.tsx` are left untouched: both sit at
the 1000-line desktop file-size ratchet, and extraction cannot grow them.
Their strings fall back to English and can be extracted when those files are
split.

Verification: `just desktop-check` clean (tsc, biome, file-size ratchet),
`just desktop-test` 4394 passed / 0 failed, including a fallback test in
`desktop/src/i18n.test.mjs`.

Signed-off-by: Sam Wong <hyperfocusam@gmail.com>
Signed-off-by: 李亦真 <liyizhen@taoke.com>
@wusuoweiju48
wusuoweiju48 requested a review from a team as a code owner August 7, 2026 04:49
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