Skip to content

feat(i18n): add 11 new languages — Korean, German, Spanish, French, Portuguese-BR, Arabic, Hindi, Thai, Vietnamese, Italian, Russian - #227

Closed
hashbender wants to merge 1 commit into
mainfrom
mirror/pr-56220
Closed

feat(i18n): add 11 new languages — Korean, German, Spanish, French, Portuguese-BR, Arabic, Hindi, Thai, Vietnamese, Italian, Russian#227
hashbender wants to merge 1 commit into
mainfrom
mirror/pr-56220

Conversation

@hashbender

Copy link
Copy Markdown
Owner

Summary

Adds 11 new Desktop UI locales to the i18n framework that landed in NousResearch#38241, expanding language support from 4 to 15.

Each locale uses defineLocale() with English fallback for any missing keys. All translations have been carried over from our earlier 15-language JSON catalog (the one in PR NousResearch#38846) and converted to the upstream TypeScript format.

New locales

Code Language Keys Status
ko 한국어 (Korean) 850 Complete
de Deutsch (German) 850 Complete
es Español (Spanish) 850 Complete
fr Français (French) 850 Complete
pt-br Português (Brasil) 850 Complete
ar العربية (Arabic) 850 Complete
hi हिन्दी (Hindi) 850 Complete
th ภาษาไทย (Thai) 850 Complete
vi Tiếng Việt (Vietnamese) 850 Complete
it Italiano (Italian) 850 Complete
ru Русский (Russian) 850 Complete

Changes

  • apps/desktop/src/i18n/types.ts: Extend Locale type union (4 → 15)
  • apps/desktop/src/i18n/catalog.ts: Import and register all 11 new locales
  • apps/desktop/src/i18n/languages.ts: Add LOCALE_OPTIONS entries, LOCALE_META, and LOCALE_ALIASES for all new locales
  • apps/desktop/src/i18n/{ko,de,es,fr,pt-br,ar,hi,th,vi,it,ru}.ts: Full translation catalogs using defineLocale()

Notes

  • Language display names are from LOCALE_META (endonym shown in picker), not translation keys
  • English fallback applies for any Desktop UI strings not yet covered
  • 11 language self-reference keys (language.{code}) omitted intentionally — upstream uses LOCALE_META
  • All keys are ~850 Desktop UI strings covering: settings, appearance, chat, onboarding, gateway, models, MCP, sessions, tools, command center, install, updates, etc.

Closes the Russian Desktop locale gap noted in NousResearch#40347.
Related: NousResearch#38846 (superseded omnibus PR)


Mirror-of: NousResearch#56220
NousResearch#56220

…ortuguese-BR, Arabic, Hindi, Thai, Vietnamese, Italian, Russian
@hashbender hashbender closed this Jul 1, 2026
@tenki-reviewer

tenki-reviewer Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Complete

Files Reviewed: 14
Findings: 1

By Severity:

  • 🔴 Critical: 1

All 11 new locale files (ar, de, es, fr, hi, it, ko, pt-br, ru, th, vi) have a structurally mismatched key hierarchy versus the Translations interface in types.ts, with bare arrow function syntax errors and flat string-to-object overwrites that will cause compilation failure and broken translations.

Files Reviewed (14 files)
apps/desktop/src/i18n/ar.ts
apps/desktop/src/i18n/catalog.ts
apps/desktop/src/i18n/de.ts
apps/desktop/src/i18n/es.ts
apps/desktop/src/i18n/fr.ts
apps/desktop/src/i18n/hi.ts
apps/desktop/src/i18n/it.ts
apps/desktop/src/i18n/ko.ts
apps/desktop/src/i18n/languages.ts
apps/desktop/src/i18n/pt-br.ts
apps/desktop/src/i18n/ru.ts
apps/desktop/src/i18n/th.ts
apps/desktop/src/i18n/types.ts
apps/desktop/src/i18n/vi.ts

@tenki-reviewer tenki-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Risk: 🔴 Critical (85/100) — 1 critical finding · 10621 LOC across 14 files


Critical Structural Mismatch in 11 Locale Files

The 11 new i18n locale files introduced in this PR share an identical structural defect that makes them uncompilable and non-functional:

Three Compounding Defects

  1. Key hierarchy mismatch — The files use 23 top-level keys (e.g., about, appearance, bootstrap, chat) that are not in the Translations interface defined in types.ts, while missing 16 required keys (assistant, desktop, settings, composer, etc.). The working reference locales (en.ts, ja.ts, zh.ts, zh-hant.ts) all follow the correct 33-key structure.

  2. Bare arrow function syntax errors — At ~28 locations per file, arrow functions appear without property keys (e.g., count => \...`). This is **not valid JavaScript/TypeScript** per ECMAScript §12.2.6 — object literal entries require a PropertyName: AssignmentExpression` form.

  3. String-to-object overwrites — Settings sections (settings.appearance, settings.model, etc.) provide flat string values instead of nested objects, which will overwrite entire sub-trees in mergeTranslations().

Files Affected

apps/desktop/src/i18n/{ar,de,es,fr,hi,it,ko,pt-br,ru,th,vi}.ts — all 11 files share identical structure patterns drawn from the same generation template.

Fix Approach

Copy en.ts as the structural template for each file and map the existing translation strings into the correct nested paths. defineLocale() automatically fills untranslated keys from the English base, so partial mapping is acceptable.


export const de = defineLocale(
{
appearance: {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 All 11 new locale files are structurally mismatched with Translations type contract — compilation will fail, translations will be broken (bug)

The 11 new locale files (ar.ts, de.ts, es.ts, fr.ts, hi.ts, it.ts, ko.ts, pt-br.ts, ru.ts, th.ts, vi.ts) were generated with a structure that does not match the Translations interface in types.ts. Three compounding defects make these files unusable:

1. Structural mismatch (holistic + domain): The files use 23 top-level keys not in the Translations interface (about, appearance, bootstrap, chat, clarify, config, file, gateway, header, intro, keys, mcp, model, models, nav, pagination, previewConsole, provider, sessions, terminal, tool, tools, urlDialog) and are missing 16 required top-level keys (assistant, desktop, fileMenu, keybinds, language, modelPicker, modelVisibility, notifications, preview, prompts, remoteDisplayBanner, rightSidebar, shell, starmap, statusStack, ui). The defineLocale() function accepts TranslationOverride, a mapped type restricted to keyof Translations — extra keys cause TypeScript compilation errors. The working reference locales (en.ts, ja.ts, zh.ts, zh-hant.ts) all use the correct 33-key structure.

2. Bare arrow function syntax errors (domain-dom-001): At ~28 locations per file, arrow functions are used as bare object literal entries without a property key prefix (e.g., count => \...`instead ofupdateReady: count => `...``). This is not valid ECMAScript or TypeScript object literal syntax per §12.2.6 of the spec. Arrow functions are AssignmentExpressions, not PropertyDefinitions — they require a PropertyName + colon prefix. Each file has these syntax errors in sections: commandCenter (line ~129), about/qbout (lines 279-289), config/keys (lines 309-312), mcp (lines 336-337, 565), sessions (line 503), gateway (line 447), updates (lines 684-685), tool (lines 722, 724), clarifier (line 865), and intro (lines 879-888). These files cannot be parsed by any JavaScript/TypeScript engine.

3. String-to-object overwrite (domain-dom-002): The settings section provides flat string values for keys that are nested objects in the Translations type (e.g., settings.appearance: 'المظهر' is a string, but Translations expects settings.appearance: { title, intro, colorMode, ... }). The mergeTranslations() function at define-locale.ts:33 does result[key] = isRecord(baseValue) && isRecord(value) ? mergeTranslations(baseValue, value) : value — since the value is a string (not a record), the entire English nested object tree is overwritten with the flat string. This causes every sub-key (colorMode, toolViewTitle, theme*, etc.) to become undefined at runtime in the affected sections (appearance, model, gateway, sessions, mcp, config, keys, about, tools).

4. Duplicate key overwrites (domain-dom-003): Even after fixing the syntax errors, plural-form entries use the same parameter name repeatedly without distinguishing keys (e.g., two adjacent count => entries for singular/plural that would need distinct property names like updateReady to coexist). In the current broken form these are unreachable; after fixing syntax they would silently lose all singular/plural distinctions.

All 11 files share identical issue patterns across all sections. The files need complete restructuring to match the Translations interface structure used by en.ts, ja.ts, zh.ts, and zh-hant.ts.

💡 Suggestion: The 11 new locale files need a complete rewrite to match the Translations interface structure. The most efficient approach: (1) Copy en.ts as the structural template for each language. (2) For each translated string in the broken files, map it into the correct nested path in the new template (e.g., broken appearance.title → correct settings.appearance.title, broken chat.send → correct composer.send, broken about section bare arrow functions → correct settings.about.updateReady: count => ..., etc.). (3) The defineLocale() merge function fills any untranslated keys from the English base automatically, so partial translations are acceptable — focus on mapping existing translations correctly. (4) Ensure every property has a proper key prefix (no bare arrow functions). (5) Ensure nested objects are provided as objects, not flat strings. Verify that the resulting files satisfy the TranslationOverrides type constraint.

📋 Prompt for AI Agents

Restructure all 11 locale files (apps/desktop/src/i18n/{ar,de,es,fr,hi,it,ko,pt-br,ru,th,vi}.ts) to match the Translations interface in types.ts. Use en.ts as the structural template. For each file: (1) Replace the entire contents with a copy of en.ts's structure; (2) Map existing translation strings from the broken file into the correct nested paths — e.g., 'appearance' block (lines 5-41) maps to settings.appearance, 'chat' block maps to composer + assistant.thread, 'about' block maps to settings.about, 'keys' block maps to settings.keys, 'config' block maps to settings.config, 'gateway' block maps to settings.gateway, 'sessions' block maps to settings.sessions, 'mcp' block maps to settings.mcp, 'tool' block maps to assistant.tool, 'pagination' maps to ui.pagination, 'previewConsole' maps to preview.console, 'nav' maps to sidebar.nav, 'terminal' maps to rightSidebar, 'clarify' maps to assistant.clarify, 'model'/'models' maps to settings.model/modelPicker/modelVisibility as appropriate; (3) Fix all bare arrow functions by adding proper property keys (e.g., 'count => ...' → 'updateReady: count => ...'); (4) Replace flat string values under settings (appearance/model/gateway/sessions/mcp/config/keys/about/tools) with the proper nested object structures; (5) Fill any new or missing keys with English fallbacks from en.ts (defineLocale handles this automatically for unmatched keys). The 11 files share identical structure, so fix one first and propagate the pattern.

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