Skip to content

nese (zh-CN) localization support - #140

Open
ziyu121 wants to merge 1 commit into
swarmclawai:mainfrom
ziyu121:feat/chinese-localization
Open

nese (zh-CN) localization support#140
ziyu121 wants to merge 1 commit into
swarmclawai:mainfrom
ziyu121:feat/chinese-localization

Conversation

@ziyu121

@ziyu121 ziyu121 commented Jul 18, 2026

Copy link
Copy Markdown

添加简体中文本地化支持

Changes

  • Added complete zh-CN.json Simplified Chinese translation file
  • Replaced all hardcoded English UI text with t() translation function
  • Fixed hardcoded English in 70+ files across the codebase
  • Auto-detect browser language and switch to Chinese when zh-CN is set
  • Added I18nProvider client component for Next.js App Router compatibility
  • Installed i18next, react-i18next, i18next-browser-languagedetector

Scope

  • Sidebar navigation, Home, Settings, Tasks, Protocols, Activity
  • Connectors, Skills, Quality, MCP Servers
  • All layout.tsx files
  • Shared components (Command Palette, Search, Keyboard Shortcuts, Confirm Dialog, etc.)

Testing

  • npm run dev runs without errors
  • All UI text displays correctly in Chinese
  • English fallback (en.json) works properly when needed

Technical Details

  • Uses i18next + react-i18next framework

  • Translation files located at src/i18n/locales/

  • All text loaded via t('key') function calls
    Notes

  • en.json remains as the fallback language

  • Users with zh-CN browser language will see Chinese automatically

    Extensibility
    This PR sets up a fully functional i18n infrastructure that makes adding new languages straightforward:

-Adding a new language** only requires:

  1. Copying en.json to a new locale file (e.g., fr.json, es.json, ja.json)
  2. Translating the values
  3. Adding the locale to the resources object in src/i18n/index.ts
  4. The language detector will automatically switch based on browser settings

-No code changes** needed in UI components when adding new languages

  • All text is centralized in JSON files, making translation management easy

  • 修改内容

  • 新增完整的 zh-CN.json 简体中文翻译文件

  • 所有界面文本已替换为 t() 翻译函数

  • 修正 70+ 个文件中的硬编码英文文本

  • 支持浏览器语言自动检测 (zh-CN)

  • 新增 I18nProvider 客户端组件,兼容 Next.js App Router

涉及范围
侧边栏、首页、设置、任务、协议、动态

  • 连接器、技能、质量、MCP 服务器
  • 所有 layout 文件
  • 通用组件(命令面板、搜索、快捷键、确认对话框等)

测试

  • npm run dev 正常运行,无编译错误
  • 所有界面正常显示中文
  • 英文回退 (en.json) 正常工作

技术实现

  • 使用 i18next + react-i18next 框架
  • 新增 src/i18n/ 目录管理翻译文件
  • 所有文本通过 t('key') 方式加载
截图 2026-07-18 15-16-13

- 添加完整的简体中文翻译文件 (zh-CN.json)
- 所有界面文本使用 i18next 翻译函数
- 修正 70+ 个文件中的硬编码英文
- 支持通过浏览器语言自动切换 (zh-CN)
- 新增 I18nProvider 客户端组件
- 安装 i18next, react-i18next, i18next-browser-languagedetector

涉及范围:
- 侧边栏、首页、设置、任务、协议、动态
- 连接器、技能、质量、MCP 服务器
- 所有 layout 文件
- 通用组件 (命令面板、搜索、快捷键、确认对话框等)

测试:
- npm run dev 正常运行
- 所有界面正常显示中文
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