feat(cli): add Traditional Chinese (zh-TW) as a UI language option#3569
Conversation
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
ade210b to
d849354
Compare
wenshao
left a comment
There was a problem hiding this comment.
[Critical] npm run check-i18n fails because the new zh-TW locale is not key-synchronized with en.js. Direct key comparison shows 5 missing keys (No server selected, Value:, 中国 (China), 中国 (China) - 阿里云百炼, 阿里云百炼 (aliyun.com)) and 7 extra keys (including the Traditional-character variants of the China/Aliyun labels). Please regenerate or manually sync zh-TW.js so its keys exactly match en.js; only the values should differ.
[Critical] scripts/check-i18n.ts still contains a stale @ts-expect-error for import.meta, and the PR introduces a changed-file typecheck failure because that directive is now unused.
— gpt-5.4 via Qwen Code /review
| nativeName: '中文', | ||
| }, | ||
| { | ||
| code: 'zh-TW', |
There was a problem hiding this comment.
[Critical] Adding zh-TW after the generic zh entry breaks the new locale for users who keep general.language on auto. detectSystemLanguage() walks SUPPORTED_LANGUAGES in order and uses startsWith(), so zh-TW/zh-TW.UTF-8 matches zh first and still resolves to Simplified Chinese.
| code: 'zh-TW', | |
| { | |
| code: 'zh-TW', | |
| id: 'zh-TW', | |
| fullName: 'Traditional Chinese', | |
| nativeName: '繁體中文', | |
| }, | |
| { | |
| code: 'zh', | |
| id: 'zh-CN', | |
| fullName: 'Chinese', | |
| nativeName: '中文', | |
| }, |
— gpt-5.4 via Qwen Code /review
| totalKeys, | ||
| translatedKeys, | ||
| translatedKeys: zhTranslatedKeys, | ||
| zhTWTranslatedKeys, |
There was a problem hiding this comment.
[Critical] The returned stats object now includes zhTWTranslatedKeys, but CheckResult.stats was not updated to declare that property. That makes npx tsc --noEmit --incremental fail on this PR.
| zhTWTranslatedKeys, | |
| zhTWTranslatedKeys: number; |
— gpt-5.4 via Qwen Code /review
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
wenshao
left a comment
There was a problem hiding this comment.
[Critical] scripts/check-i18n.ts now requires stats.zhTWTranslatedKeys, but some return paths still construct stats without this property, which makes npx tsc --noEmit fail. Either remove this field from the type or populate it in every returned stats object.
[Critical] checkKeyMatching is still hard-coded to emit diagnostics for zh.js; the new zh-TW validation reuses it, so missing or extra keys in zh-TW.js will be reported as zh.js, making the new locale validation misleading. Pass a locale label into the helper and use it in diagnostics.
— gpt-5.5 via Qwen Code /review
| '全局記憶文件未找到或當前爲空', | ||
| 'Global memory is currently empty.': '全局記憶當前爲空', | ||
| 'Global memory content:\n\n---\n{{content}}\n---': | ||
| '全局記憶內容:\\n\\n---\\n{{content}}\\n---', |
There was a problem hiding this comment.
[Critical] This value double-escapes newline sequences (\\n), while the source key uses normal newline escapes. When zh-TW is selected, the CLI will render literal \n text instead of line breaks. The same pattern appears in several other translated values in this file.
| '全局記憶內容:\\n\\n---\\n{{content}}\\n---', | |
| '全局記憶內容:\n\n---\n{{content}}\n---', |
— gpt-5.5 via Qwen Code /review
…-i18n.ts Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
wenshao
left a comment
There was a problem hiding this comment.
[Critical] packages/cli/src/i18n/locales/zh-TW.js 缺少 136 个翻译键(npm run check-i18n 退出码 1)。缺失的键包括 "Status", "Model", "Settings", "Tools", "Yes", "No", "Error", "Back", "cancel", "Hooks", "Extensions", "Workspace" 等基本 UI 文本。使用 zh-TW 语言时这些 UI 字符串将回退显示英文 key 名而非繁体中文。
请使用 opencc (s2t) 从 en.js 或 zh.js 的值补全缺失翻译,然后运行 npm run check-i18n 验证通过。
其余变更(languages.ts、settings.schema.json、check-i18n.ts、useResumeCommand.ts)均正确,构建和测试通过。
— deepseek-v4-pro via Qwen Code /review
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Convert zh-TW.js keys from double-quoted to single-quoted to match en.js style - Fix zh.js key mismatches: add missing keys (Value:, No server selected, prompts, required, Enum) and remove extra keys (The name of the extension to update, Session (temporary)) - Regenerate unused-keys-only-in-locales.json Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Resolve merge conflicts in zh.js (prompts/required translations) and restore 4 keys that main added to en.js. Regenerate zh-TW.js to sync all 1267 keys at 100% coverage. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add getCurrentLanguage() to useMemo deps in usePhraseCycler so that WITTY_LOADING_PHRASES re-evaluates after a /language switch instead of staying locked to the language active at mount time. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
wenshao
left a comment
There was a problem hiding this comment.
[Suggestion] detectSystemLanguage() currently checks environment locales with envLang.startsWith(lang.code). Common POSIX locales use underscores, for example LANG=zh_TW.UTF-8, which does not start with the new zh-TW code and then falls through to the later generic zh entry. Users with a standard zh_TW.UTF-8 environment will still auto-detect Simplified Chinese instead of Traditional Chinese. Consider normalizing separators/case before matching, or comparing normalized code/id values after replacing _ with -.
— gpt-5.5 via Qwen Code /review
| nativeName: 'English', | ||
| }, | ||
| { | ||
| code: 'zh-TW', |
There was a problem hiding this comment.
[Suggestion] Adding zh-TW as a mixed-case language code exposes an existing case-sensitive lookup in getLanguageNameFromLocale(): normalizeOutputLanguage() lowercases user input before calling it, so /language output zh-TW becomes zh-tw and is preserved as the literal string instead of resolving to Traditional Chinese.
| code: 'zh-TW', | |
| code: 'zh-tw', |
Alternatively, keep the canonical code and make getLanguageNameFromLocale() compare l.code.toLowerCase() against the normalized input.
— gpt-5.5 via Qwen Code /review
…age lookup
- detectSystemLanguage(): normalize POSIX locales (e.g. zh_TW.UTF-8 → zh-tw)
by replacing underscores with hyphens and lowercasing before matching, so
users with LANG=zh_TW.UTF-8 correctly detect zh-TW instead of falling
through to zh
- getLanguageNameFromLocale(): compare codes case-insensitively so that
normalizeOutputLanguage('zh-TW') resolves to 'Traditional Chinese' instead
of falling back to 'English'
- Add test cases for zh-TW / zh-tw / ZH-TW in normalizeOutputLanguage
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add 'zh-tw' entry to the mock map and normalize locale input with toLowerCase() so the mock mirrors the real case-insensitive implementation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
wenshao
left a comment
There was a problem hiding this comment.
No issues found. LGTM! ✅ — gpt-5.5 via Qwen Code /review
…wenLM#3569) * feat(cli): add Traditional Chinese (zh-TW) as a UI language option Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix: use upstream unused-keys-only-in-locales.json to resolve conflict Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * revert: remove check-i18n.ts changes to avoid pre-existing zh.js issues Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * feat(cli): add Traditional Chinese (zh-TW) as a UI language option Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix(cli): add WITTY_LOADING_PHRASES to zh-TW locale Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix(cli): sync zh-TW.js with en.js keys, fix double-escape, fix check-i18n.ts Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix: resolve conflict in unused-keys-only-in-locales.json Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix(cli): add missing Performance translation to zh-TW Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix(cli): add quotes to Performance key in zh-TW Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix(cli): regenerate zh-TW.js with correct multi-line value parsing Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix: resolve conflict in unused-keys-only-in-locales.json Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix(cli): regenerate zh-TW.js with correct multi-line value parsing Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix(cli): standardize zh-TW.js key quoting and sync zh.js keys - Convert zh-TW.js keys from double-quoted to single-quoted to match en.js style - Fix zh.js key mismatches: add missing keys (Value:, No server selected, prompts, required, Enum) and remove extra keys (The name of the extension to update, Session (temporary)) - Regenerate unused-keys-only-in-locales.json Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix(cli): update loading phrases when UI language changes Add getCurrentLanguage() to useMemo deps in usePhraseCycler so that WITTY_LOADING_PHRASES re-evaluates after a /language switch instead of staying locked to the language active at mount time. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(i18n): normalize locale separators and fix case-insensitive language lookup - detectSystemLanguage(): normalize POSIX locales (e.g. zh_TW.UTF-8 → zh-tw) by replacing underscores with hyphens and lowercasing before matching, so users with LANG=zh_TW.UTF-8 correctly detect zh-TW instead of falling through to zh - getLanguageNameFromLocale(): compare codes case-insensitively so that normalizeOutputLanguage('zh-TW') resolves to 'Traditional Chinese' instead of falling back to 'English' - Add test cases for zh-TW / zh-tw / ZH-TW in normalizeOutputLanguage Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(test): update getLanguageNameFromLocale mock to include zh-TW Add 'zh-tw' entry to the mock map and normalize locale input with toLowerCase() so the mock mirrors the real case-insensitive implementation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Description
Adds Traditional Chinese (zh-TW) as a dedicated UI language option in Qwen Code. Previously, only Simplified Chinese (zh-CN) was available.
This change allows users who prefer Traditional Chinese to select it via
/language ui zh-TWor the settings panel.Changes
packages/cli/src/i18n/languages.ts: Addedzh-TWlanguage definition (Traditional Chinese/繁體中文) toSUPPORTED_LANGUAGESandSupportedLanguagetype union.packages/cli/src/i18n/locales/zh-TW.js: New file — Traditional Chinese translation based onzh.js(Simplified Chinese), converted usingopencc.packages/vscode-ide-companion/schemas/settings.schema.json: Addedzh-TWto thelanguageenum and updated the description.scripts/check-i18n.ts: Addedzh-TW.jsto the i18n key-matching check, so future PRs will verify thatzh-TW.jsstays in sync withen.js.scripts/unused-keys-only-in-locales.json: Updated by runningnpm run check-i18n.How zh-TW.js was generated
The Simplified Chinese locale (
zh.js) was converted to Traditional Chinese using opencc (s2tconverter). This ensures consistent coverage of all i18n keys while using the correct Traditional Chinese characters.Testing
npm run buildnpm run check-i18n— all keys match betweenen.jsandzh-TW.js/language uinow showszh-TWas an option