feat: add i18n infrastructure with Chinese (简体中文) language support

WA
6mo ago
+3746-2412

Summary

Add full i18n (internationalization) infrastructure with built-in Chinese (简体中文) and English language support.

Changes

i18n Infrastructure

  • Initialize i18next + react-i18next with key = fallback pattern (English text = translation key)
  • All 5 renderer entry points (hub/, onboarding/, pill/, popup/, logs/) wrapped with <I18nextProvider>
  • Language preference persisted in localStorage

Locale Files

  • app/src/renderer/locales/en.json — 433 English source strings
  • app/src/renderer/locales/zh.json — 433 Chinese (simplified) translations

Components Translated

All core UI components covered: SettingsPane, Sidebar, Dashboard, AgentPane, HubApp, OnboardingApp, ConnectionsPane, KeybindingsOverlay, CommandBar, TaskInput, Navbar, MemoryIndicator, Pill, LogsApp, Toast, EnginePicker, etc.

Chat modules: ChatPane, ChatTurn, ToolBlock, ChatTranscript, BrowserPreview, TerminalSpinner, CodeBlock, AskForm, OptionList

Tool labels & spinner presets: toolLabels.ts (~130 tool verb phrases), spinnerVerbs.ts (7 presets)

Settings UI

  • Language dropdown added to Settings → Language (English / 简体中文)

Documentation

  • README.md — added bilingual sections (English + Chinese)
  • CONTRIBUTING.md — added bilingual i18n guide for translators

How to Test

  1. Launch the app
  2. Go to Settings → Language
  3. Switch to 简体中文
  4. All UI strings should display in Chinese

Notes

  • Missing keys fall back gracefully to English (key = fallback)
  • To add a new locale: create {locale}.json, add all keys from en.json, add option in SettingsPane.tsx

Summary by cubic

Adds full i18n across the app with English and Simplified Chinese (简体中文), plus a language switcher in Settings. All UI text and aria labels load from locale files with an English-as-key fallback.

  • New Features

    • Integrated i18next + react-i18next; added en.json and zh.json (726 strings) and wrapped renderer roots (hub/, onboarding/, pill/, popup/, logs/) in I18nextProvider.
    • Added Settings → Language with preference saved in localStorage.
    • Localized core UI and chat modules, tool labels, and spinner presets; added README.zh.md and CONTRIBUTING.zh.md with doc language switchers.
  • Bug Fixes

    • Configured custom interpolation (prefix $) and moved runtime-only translations to render-time; preserved required English literals for backend string comparisons.
    • Localized empty/error states, titles, and aria labels across components; re-applied i18n in OptionList after upstream merge.
    • Wrapped remaining CookieBrowser.tsx header strings and toast messages in i18n; added cookie sync descriptions to locale files.
    • Localized relative time strings in CookieBrowser.tsx (e.g., “just now”, “5m ago”).