Skip to content

Add Chinese UI Localization Support #30060

Open

Description

@shijialing

What variant of Codex are you using?

App

What feature would you like to see?

问题描述 / Problem

Codex 目前只内置了英文界面。配置项 localeOverride = "zh-CN" 虽然存在于 config.toml 中,但当前版本没有包含中文翻译资源,设置后界面仍然是英文。

Currently Codex only has English UI. The localeOverride = "zh-CN" setting exists in config.toml, but Chinese translation resources are not bundled in the current release.

调查发现 / Investigation

  • Desktop version: 26.616.10790.0 (CLI v0.142.0)
  • AppxManifest: 只声明了 <Resource Language="en-US" />
  • locales/ 目录: 有 zh-CN.pak 文件,但只覆盖 Electron/Chromium 壳层(右键菜单、文件对话框等),不影响 Codex 自身的 React UI
  • app.asar: Codex 的 React 前端编译在此文件中,未包含中文翻译
  • 配置: config.toml 中的 localeOverride = "zh-CN" 配置项已存在且语法正确,但没有对应的翻译文件可加载

需要翻译的 UI 元素 / UI Elements Requiring Translation

1️⃣ 侧边栏 (Sidebar)

英文 (Current) 中文 (Target)
New Chat 新建对话
Search threads... 搜索对话...
Threads / Chats 对话列表
Settings 设置
Theme 主题
Font Size 字体大小
Language 语言
Shortcuts 快捷键
About 关于

2️⃣ 顶部栏 (Top Bar)

英文 (Current) 中文 (Target)
Model Selector 模型选择
Conversation title 对话标题

3️⃣ 消息区域 (Messages)

英文 (Current) 中文 (Target)
Thinking... 思考中...
Copy 复制
Copy code 复制代码
Code copied 已复制
Show thinking 显示思考过程
Hide thinking 隐藏思考过程
Just now 刚刚
minutes ago 分钟前
hours ago 小时前
days ago 天前

4️⃣ 输入区域 (Input Area)

英文 (Current) 中文 (Target)
Type a message... 输入消息...
Send 发送
Attach files 附件
Paste 粘贴
Search code 搜索代码
Press Enter to send, Shift+Enter for new line Enter 发送,Shift+Enter 换行
Ctrl+K to search 按 Ctrl+K 搜索

5️⃣ 设置面板 (Settings)

英文 (Current) 中文 (Target)
Model Settings 模型设置
Conversation Detail Mode 对话详情模式
Auto-suggestions 自动建议
Interface Language 界面语言
System Font Size 系统字体大小
Code Font Size 代码字体大小
Developer Options 开发者选项
Custom Model Provider 自定义模型提供商
Base URL 接口地址
API Key API 密钥
Sandbox Mode 沙盒模式
Elevated 提权模式

6️⃣ 右键菜单 (Context Menu)

英文 (Current) 中文 (Target)
Cut 剪切
Copy 复制
Paste 粘贴
Select All 全选
Copy Code Block 复制代码块
Copy Message 复制消息
Delete Message 删除消息
Edit Message 编辑消息

7️⃣ 工具提示和状态 (Tooltips & Status)

英文 (Current) 中文 (Target)
Connected 已连接
Disconnected 已断开
Reconnecting... 重新连接中...
Streaming... 正在生成...
Error 错误
Warning 警告
Loading... 加载中...
No results 无结果
File not found 文件未找到
Permission denied 权限被拒绝

8️⃣ 文件浏览器 (File Browser)

英文 (Current) 中文 (Target)
Open File 打开文件
Save File 保存文件
Select Folder 选择文件夹
File name 文件名
File type 文件类型
Cancel 取消
Confirm 确认
Browse... 浏览...

建议的实现方式 / Implementation Suggestions

方案一:使用 react-i18next(推荐)

Codex 前端使用 React,react-i18next 是最成熟的国际化方案:

  1. 安装 react-i18next 和 i18next
  2. 创建 public/locales/zh-CN/translation.json 翻译文件
  3. 在应用初始化时检测 localeOverride 配置,加载对应语言
  4. 将所有硬编码的字符串替换为 t() 函数调用
  5. 确保语言切换无需重启应用

方案二:使用 TypeScript 国际化方案

如果项目已使用 TypeScript,也可以考虑用 typescript-i18n 或自定义方案:

  1. 创建 src/i18n/zh-CN.ts 翻译映射
  2. 创建一个 useLocale() hook
  3. 通过 Context 向下传递当前语言
  4. 构建时将所有语言的翻译打包

关键实现要点

  • 读取 ~/.codex/config.toml 中的 [desktop] localeOverride 配置
  • 监听语言配置变化,实时更新 UI
  • 日期、时间等格式使用 Intl API 自动适配中文格式
  • 支持 Plural(复数) 规则(中文不需要复杂复数形式)
  • 代码块和终端输出保持英文原样,只翻译界面元素

参考 UI 设计 / Visual Reference

HTML 模拟界面文件: Codex中文界面模拟.html
(包含完整的中文界面布局和元素标注)

环境信息 / Environment

  • OS: Windows 11 24H2
  • Codex Desktop: v26.616.10790.0
  • Codex CLI: v0.142.0
  • Install source: Microsoft Store (WindowsApps)

其他用户反馈 / Additional Notes

中文开发者社区对 Codex 非常感兴趣,但语言门槛阻碍了广泛采用。根据开发者社区的反馈:

  • 大量中国开发者习惯使用中文界面的开发工具(如 VS Code 中文版)
  • 支持中文界面可以显著降低 AI 编程工具的入门门槛
  • 建议同时支持 zh-CN(简体中文)和 zh-TW(繁体中文)

Additional information

No response

Activity

  1. added
    enhancement
    on Jun 25, 2026
  2. added
    app
    config
    on Jun 25, 2026
  3. changed the title [-]添加中文界面支持 (Add Chinese UI Localization)[/-] [+]Add Chinese UI Localization Support[/+] on Jun 25, 2026
  4. github-actions commented on Jun 25, 2026

    @github-actions
    Contributor

    English translation:

    What variant of Codex are you using?

    App

    What feature would you like to see?

    Issue Description / Problem

    Codex currently only includes an English UI. Although the localeOverride = "zh-CN" setting exists in config.toml, the current version does not include Chinese translation resources, so the interface remains in English after setting it.

    Currently Codex only has English UI. The localeOverride = "zh-CN" setting exists in config.toml, but Chinese translation resources are not bundled in the current release.

    Investigation / Investigation

    • Desktop version: 26.616.10790.0 (CLI v0.142.0)
    • AppxManifest: Only declares <Resource Language="en-US" />
    • locales/ directory: There is a zh-CN.pak file, but it only covers the Electron/Chromium shell layer (context menus, file dialogs, etc.) and does not affect Codex's own React UI
    • app.asar: Codex's React frontend is compiled into this file and does not include Chinese translations
    • Configuration: The localeOverride = "zh-CN" configuration item in config.toml already exists and has correct syntax, but there is no corresponding translation file to load

    UI Elements Requiring Translation / UI Elements Requiring Translation

    1️⃣ Sidebar (Sidebar)

    English (Current) Chinese (Target)
    New Chat New conversation
    Search threads... Search conversations...
    Threads / Chats Conversation list
    Settings Settings
    Theme Theme
    Font Size Font size
    Language Language
    Shortcuts Shortcuts
    About About

    2️⃣ Top Bar (Top Bar)

    English (Current) Chinese (Target)
    Model Selector Model selection
    Conversation title Conversation title

    3️⃣ Messages (Messages)

    English (Current) Chinese (Target)
    Thinking... Thinking...
    Copy Copy
    Copy code Copy code
    Code copied Copied
    Show thinking Show thinking process
    Hide thinking Hide thinking process
    Just now Just now
    minutes ago minutes ago
    hours ago hours ago
    days ago days ago

    4️⃣ Input Area (Input Area)

    English (Current) Chinese (Target)
    Type a message... Enter a message...
    Send Send
    Attach files Attachments
    Paste Paste
    Search code Search code
    Press Enter to send, Shift+Enter for new line Enter to send, Shift+Enter for a new line
    Ctrl+K to search Press Ctrl+K to search

    5️⃣ Settings Panel (Settings)

    English (Current) Chinese (Target)
    Model Settings Model settings
    Conversation Detail Mode Conversation detail mode
    Auto-suggestions Auto suggestions
    Interface Language Interface language
    System Font Size System font size
    Code Font Size Code font size
    Developer Options Developer options
    Custom Model Provider Custom model provider
    Base URL API endpoint
    API Key API key
    Sandbox Mode Sandbox mode
    Elevated Elevated mode

    6️⃣ Context Menu (Context Menu)

    English (Current) Chinese (Target)
    Cut Cut
    Copy Copy
    Paste Paste
    Select All Select all
    Copy Code Block Copy code block
    Copy Message Copy message
    Delete Message Delete message
    Edit Message Edit message

    7️⃣ Tooltips & Status (Tooltips & Status)

    English (Current) Chinese (Target)
    Connected Connected
    Disconnected Disconnected
    Reconnecting... Reconnecting...
    Streaming... Generating...
    Error Error
    Warning Warning
    Loading... Loading...
    No results No results
    File not found File not found
    Permission denied Permission denied

    8️⃣ File Browser (File Browser)

    English (Current) Chinese (Target)
    Open File Open file
    Save File Save file
    Select Folder Select folder
    File name File name
    File type File type
    Cancel Cancel
    Confirm Confirm
    Browse... Browse...

    Suggested Implementation / Implementation Suggestions

    Option 1: Use react-i18next (recommended)

    Codex's frontend uses React, and react-i18next is the most mature internationalization solution:

    1. Install react-i18next and i18next
    2. Create the public/locales/zh-CN/translation.json translation file
    3. Detect the localeOverride configuration during app initialization and load the corresponding language
    4. Replace all hardcoded strings with t() function calls
    5. Ensure language switching does not require restarting the app

    Option 2: Use a TypeScript internationalization solution

    If the project already uses TypeScript, you could also consider typescript-i18n or a custom solution:

    1. Create a src/i18n/zh-CN.ts translation map
    2. Create a useLocale() hook
    3. Pass the current language down through Context
    4. Bundle translations for all languages at build time

    Key Implementation Points

    • Read the [desktop] localeOverride configuration from ~/.codex/config.toml
    • Listen for language configuration changes and update the UI in real time
    • Use the Intl API to automatically adapt date, time, and other formats to Chinese formatting
    • Support plural rules (Chinese does not require complex plural forms)
    • Keep code blocks and terminal output in English as-is, and only translate UI elements

    Reference UI Design / Visual Reference

    HTML mock UI file: Codex中文界面模拟.html
    (Contains the complete Chinese interface layout and element annotations)

    Environment Information / Environment

    • OS: Windows 11 24H2
    • Codex Desktop: v26.616.10790.0
    • Codex CLI: v0.142.0
    • Install source: Microsoft Store (WindowsApps)

    Other User Feedback / Additional Notes

    The Chinese developer community is very interested in Codex, but the language barrier prevents broader adoption. According to feedback from the developer community:

    • Many Chinese developers are used to using development tools with Chinese interfaces (such as the Chinese version of VS Code)
    • Supporting a Chinese UI can significantly lower the entry barrier for AI programming tools
    • It is recommended to support both zh-CN (Simplified Chinese) and zh-TW (Traditional Chinese)

    Additional information

    No response

  5. julyaaj-lang commented on Jul 10, 2026

    @julyaaj-lang

    +1, providing reproducible details from Codex CLI v0.x (commit unreleased as of 2026-07-10).

    Repro:

    1. Set [desktop] localeOverride = "zh-CN" in ~/.codex/config.toml.
    2. Export LANG=zh_CN.UTF-8 LC_ALL=zh_CN.UTF-8 before launching.
    3. Run codex in Terminal on macOS 15.

    Observed:

    • Codex Desktop app UI: fully localized to zh-CN ✅
    • Codex CLI (terminal binary): prompts, status bar, error messages remain 100% English, regardless of locale env vars or config.

    Expected:

    • CLI should respect desktop.localeOverride and LANG like the desktop app does.

    Notes:

    中文摘要:CLI 完全没本地化,即使设了 localeOverride 和 LANG 也没用。希望官方引入 i18n 框架并合入中文 locale 文件。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appconfigenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions