feat(desktop): add 11 new languages — hybrid JSON + TypeScript i18n system - #56246
Closed
iaendi wants to merge 2 commits into
Closed
feat(desktop): add 11 new languages — hybrid JSON + TypeScript i18n system#56246iaendi wants to merge 2 commits into
iaendi wants to merge 2 commits into
Conversation
Hybrid approach: JSON translation files (translator-friendly) + upstream
TypeScript i18n framework (type-safe runtime) + sync-locales.py bridge.
New locales (11 + 4 upstream = 15 total):
Korean, German, Spanish, French, Portuguese-Brazil,
Arabic, Hindi, Thai, Vietnamese, Italian, Russian
Architecture:
locales/*.json — Canonical translation source (flat keys, 861 per locale)
scripts/sync-locales.py — Validates JSON → generates defineLocale() .ts files
i18n/{code}.ts — TypeScript locale catalogs for upstream framework
i18n/catalog.ts — Auto-generated, imports all 15 locales
i18n/types.ts — Locale type union extended
i18n/languages.ts — LOCALE_OPTIONS + LOCALE_ALIASES for all 15
To add a new language:
1. Drop {code}.json into locales/
2. Add to KNOWN_LOCALES in sync-locales.py
3. Run python3 scripts/sync-locales.py
4. That's it — no manual TS files to write
Upstream locales (en, ja, zh, zh-hant) preserved intact.
The 11 new locales use defineLocale() with English fallback.
[skip ci]
This was referenced Jul 1, 2026
Author
|
This PR carries forward the translation work and zh-CN polish review (@starlit-dream) from the earlier #38846 (now closed). The architecture has evolved from pure JSON to a hybrid JSON+TS workflow — see the PR description for details. Related issues that this addresses:
|
…dd KEYS_TO_SKIP for path mismatches
- Fix sync-locales.py render() missing key names before arrow functions
- Fix types.ts line-based replacement to avoid regex corruption
- Add KEYS_TO_SKIP for settings.{appearance,model,gateway,sessions,tools,mcp,config,keys,about}
(these map to settings.nav.{key} in upstream, not settings.{key})
- Regenerate all 11 locale TS files
- typecheck now passes with ~15 known path-mismatch errors (all fall back to en)
[skip ci]
Author
|
Superseded by #38846 (reopened with the hybrid JSON+TS approach merged in). |
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.
What
Adds 11 new Desktop UI locales and a hybrid JSON+TypeScript i18n system that combines the best of both approaches.
New locales (11 + 4 existing = 15 total):
ko (한국어), de (Deutsch), es (Español), fr (Français), pt-BR (Português Brasil), ar (العربية), hi (हिन्दी), th (ภาษาไทย), vi (Tiếng Việt), it (Italiano), ru (Русский)
Architecture — best of both worlds
JSON files (locales/*.json):
TypeScript framework (i18n/*.ts):
Bridge script (scripts/sync-locales.py):
Why this approach
Files changed
Supersedes the earlier omnibus PR #38846.
Closes the Russian Desktop locale gap noted in #40347.