Skip to content

feat(desktop): add 11 new languages — hybrid JSON + TypeScript i18n system - #253

Open
hashbender wants to merge 1 commit into
mainfrom
mirror/pr-56246
Open

feat(desktop): add 11 new languages — hybrid JSON + TypeScript i18n system#253
hashbender wants to merge 1 commit into
mainfrom
mirror/pr-56246

Conversation

@hashbender

Copy link
Copy Markdown
Owner

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

locales/*.json              <- Canonical translation source (flat keys, easy for translators)
       |
       v
scripts/sync-locales.py     <- Validates -> generates defineLocale() .ts files
       |
       v
i18n/{code}.ts              <- Upstream type-safe framework (runtime, context, types)
       |
       v
i18n/types.ts / catalog.ts / languages.ts -> All 15 locales registered

JSON files (locales/*.json):

  • Flat key-value pairs, ~850 Desktop UI strings each
  • Translators only need to edit JSON - no TypeScript knowledge required
  • Key parity test (locales.test.ts) catches regressions
  • Drop a new {code}.json -> run sync-locales.py -> it works

TypeScript framework (i18n/*.ts):

Bridge script (scripts/sync-locales.py):

  • Reads JSON -> validates keys against en.json -> generates defineLocale() .ts
  • Updates catalog.ts, types.ts (Locale type), languages.ts automatically
  • Run: python3 apps/desktop/scripts/sync-locales.py

Why this approach

Concern JSON-only TS-only (upstream) Hybrid (this PR)
Translator DX Drop JSON file Must write TS JSON still works
Type safety None Full type check Full type check
Upstream compat Custom framework Uses merged infra Uses merged infra
Add new language Drop JSON 4 files to edit Drop JSON + config
CI validation Manual tsc catches it tsc + sync validate

Files changed

  • 32 files, +24,000 / -804
  • 11 new .ts locale catalogs
  • 15 JSON locale files + test + TRANSLATING.md
  • scripts/sync-locales.py - the bridge tool
  • i18n/catalog.ts, types.ts, languages.ts - updated

Supersedes the earlier omnibus PR NousResearch#38846.
Closes the Russian Desktop locale gap noted in NousResearch#40347.


Mirror-of: NousResearch#56246
NousResearch#56246

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