• Will Chen's avatar
    Add i18n internationalization support with language selector (#2450) · b1c4aa28
    Will Chen 提交于
    ## Summary
    - Set up i18n infrastructure using i18next with locale files for English
    (chat, common, errors, home, settings namespaces)
    - Add LanguageSelector component to the settings page for users to
    switch languages
    - Add language preference field to the app schema and integrate i18next
    provider in the app layout and renderer
    
    ## Test plan
    - Verify the app builds and starts without errors
    - Navigate to Settings and confirm the Language Selector is visible and
    functional
    - Confirm English translations load correctly across all namespaces
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    <!-- devin-review-badge-begin -->
    
    ---
    
    <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/2450">
      <picture>
    <source media="(prefers-color-scheme: dark)"
    srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1">
    <img
    src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1"
    alt="Open with Devin">
      </picture>
    </a>
    <!-- devin-review-badge-end -->
    
    <!-- CURSOR_SUMMARY -->
    ---
    
    > [!NOTE]
    > **Medium Risk**
    > Broad UI text refactor plus new runtime language switching could
    surface missing keys, incorrect namespaces, or layout regressions,
    though changes are largely non-functional and localized to presentation.
    > 
    > **Overview**
    > Adds app-wide internationalization via `i18next`/`react-i18next`,
    including a new `src/i18n` initialization with bundled namespaces and
    locale resources.
    > 
    > Introduces a persisted `language` setting (validated by
    `LanguageSchema`) plus a new `LanguageSelector` UI, and syncs the active
    i18n language at startup in `RootLayout`.
    > 
    > Migrates many user-facing strings across chat, settings, integrations,
    dialogs, banners, and preview panel components to use `t()` translation
    keys (with interpolation/plurals) instead of hardcoded English, and adds
    an i18n design doc. Dependencies are updated in `package.json`/lockfile.
    > 
    > <sup>Written by [Cursor
    Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
    a996131500b0f99ea766036084972f9863aca81d. This will update automatically
    on new commits. Configure
    [here](https://cursor.com/dashboard?tab=bugbot).</sup>
    <!-- /CURSOR_SUMMARY -->
    
    <!-- This is an auto-generated description by cubic. -->
    ---
    ## Summary by cubic
    Add app-wide internationalization with i18next and a language selector
    in Settings. The chosen language persists and updates the UI instantly;
    ships with English, Simplified Chinese (zh-CN), and Brazilian Portuguese
    (pt-BR), aligned with the Linear issue, and migrates UI text across the
    app.
    
    - **New Features**
    - Initialize i18next/react-i18next with namespaces (common, settings,
    chat, home, errors) before render; sync to UserSettings.language on
    startup.
    - Add LanguageSelector in Settings → General showing only completed
    locales; saves validated values and switches UI language.
    - Include complete en, zh-CN, pt-BR translations, Intl-based
    date/number/relative-time helpers, and docs/i18n.md.
    
    - **Refactors**
      - Replace hardcoded strings with t() across 50+ components.
    - Validate settings.language via LanguageSchema.safeParse; defer
    changeLanguage to layout sync to avoid duplicates; add error handling
    for updateSettings; extract constants in formatRelativeTime.
    
    <sup>Written for commit b670b0489415ca966db1f70f0a1ad3111a455538.
    Summary will update on new commits.</sup>
    
    <!-- End of auto-generated description by cubic. -->
    
    ---------
    Co-authored-by: 's avatarClaude Opus 4.5 <noreply@anthropic.com>
    Co-authored-by: 's avatarclaude[bot] <41898282+claude[bot]@users.noreply.github.com>
    b1c4aa28
名称
最后提交
最后更新
.claude 正在载入提交数据...
.cursor/rules 正在载入提交数据...
.devcontainer 正在载入提交数据...
.github 正在载入提交数据...
.husky 正在载入提交数据...
.storybook 正在载入提交数据...
assets 正在载入提交数据...
docs 正在载入提交数据...
drizzle 正在载入提交数据...
e2e-tests 正在载入提交数据...
makers 正在载入提交数据...
packages/@dyad-sh 正在载入提交数据...
rules 正在载入提交数据...
scaffold 正在载入提交数据...
scripts 正在载入提交数据...
shared 正在载入提交数据...
src 正在载入提交数据...
testing 正在载入提交数据...
tools 正在载入提交数据...
worker 正在载入提交数据...
workers/tsc 正在载入提交数据...
.cursorignore 正在载入提交数据...
.env.example 正在载入提交数据...
.eslintrc.json 正在载入提交数据...
.gitattributes 正在载入提交数据...
.gitignore 正在载入提交数据...
.oxfmtrc.json 正在载入提交数据...
.oxlintrc.json 正在载入提交数据...
.prettierignore 正在载入提交数据...
.prettierrc 正在载入提交数据...
AGENTS.md 正在载入提交数据...
CLA.md 正在载入提交数据...
CLAUDE.md 正在载入提交数据...
CONTRIBUTING.md 正在载入提交数据...
LICENSE 正在载入提交数据...
README.md 正在载入提交数据...
SECURITY.md 正在载入提交数据...
biome.json 正在载入提交数据...
components.json 正在载入提交数据...
drizzle.config.ts 正在载入提交数据...
forge.config.ts 正在载入提交数据...
forge.env.d.ts 正在载入提交数据...
index.html 正在载入提交数据...
lint-staged.config.js 正在载入提交数据...
merge.config.ts 正在载入提交数据...
package-lock.json 正在载入提交数据...
package.json 正在载入提交数据...
playwright.config.ts 正在载入提交数据...
tsconfig.app.json 正在载入提交数据...
tsconfig.json 正在载入提交数据...
tsconfig.node.json 正在载入提交数据...
vite.main.config.mts 正在载入提交数据...
vite.preload.config.mts 正在载入提交数据...
vite.renderer.config.mts 正在载入提交数据...
vite.worker.config.mts 正在载入提交数据...
vitest.config.ts 正在载入提交数据...
windowsSign.ts 正在载入提交数据...