feat(desktop): add i18n with system language support - #5152
Open
wusuoweiju48 wants to merge 2 commits into
Open
Conversation
…#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>
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
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.
react-i18nextinto the desktop app with English fallback.en,zh-Hans, andzh-Hantlocale resources and a bounded first extraction across high-traffic desktop surfaces.systemlanguage preference and use it by default when no explicit preference is stored.labelKeyand add its missing strings to all three locales.Related issue
Testing
pnpm typecheckpnpm test— 4,403 passed, 0 failedpnpm exec biome checkon all changed TypeScript, test, and locale filespnpm buildpnpm check:file-sizespnpm check:px-textpnpm check:pubkey-truncationManual verification
Screenshots
Follow system
Simplified Chinese