Skip to content

Add zh-TW (Traditional Chinese) interface locale - #4

Open
eugenetwtw wants to merge 11 commits into
nexu-io:masterfrom
eugenetwtw:feat/zh-tw-locale
Open

Add zh-TW (Traditional Chinese) interface locale#4
eugenetwtw wants to merge 11 commits into
nexu-io:masterfrom
eugenetwtw:feat/zh-tw-locale

Conversation

@eugenetwtw

@eugenetwtw eugenetwtw commented Jul 28, 2026

Copy link
Copy Markdown

Outcome

Traditional Chinese users currently have to pick between Simplified Chinese and English, and because DEFAULT_UI_LOCALE is zh-CN they also land on Simplified by default. The gap is not only orthographic: the vocabulary differs (幻灯片/投影片, 模板/範本, 项目/專案, 导出/匯出), so Simplified copy reads as a foreign product rather than a translated one. This adds 繁體中文 as a fourth interface locale.

Changes

  • src/i18n/types.ts, src/i18n/messages.ts: register zh-TW in Locale, LOCALES, LOCALE_LABEL, and DICTS.
  • src/i18n/locales/zh-TW.ts: new dictionary covering all 977 keys.
  • src/components/GlobalSettings.tsx: 繁 badge for the new option. zh-CN moves from the generic 文 to 简, since with two Chinese entries the generic glyph is ambiguous — happy to revert that one character if you prefer a minimal diff.
  • src/lib/templates.ts, src/lib/scenarios.ts: resolve zh-TW to the Chinese copy instead of falling through to English.
  • src/lib/onboard.ts: ask the agent for "Traditional Chinese (Taiwan)" so generated decks and speaker notes are not Simplified.
  • src/lib/questionSemantics.ts: widen QuestionCopyLocale (required — onboard.ts passes a UiLocale into it) and add the render-quality fallback copy.
  • mcp/server.mjs: add zh-TW to the three locale enums so Browser, CLI, and MCP stay one contract.
  • README.md, CONTRIBUTING.md: document the fourth locale and the new dictionary file.

On the translation itself: it is derived from zh-CN.ts by transforming the values programmatically — a Taiwan terminology layer first (投影片, 範本, 專案, 匯出, 儲存, 介面, 預設, 螢幕, 使用者, 資料, 訊息, 程式碼, 簡報 …), then character conversion — so keys, ordering, and {{placeholder}} tokens are preserved by construction rather than by hand.

Verification

This branch was authored through the GitHub web editor, so I have not been able to run the local gates. I have left the checklist unchecked rather than imply otherwise:

  • npm run typecheck
  • npm test
  • npm run check:i18n
  • npm run check:project-sync
  • npm run check:skill
  • npm run check:mcp
  • npm run build

What I did verify mechanically against the committed files, by replicating the dictionary logic in scripts/check-i18n.mjs: LOCALES parses to en, zh-CN, zh-TW, ja; each locale file contains exactly the 977 English keys with 0 missing, 0 extra, and 0 duplicates; {{placeholder}} sets match English for every key in all four locales; and no Simplified-only character remains in zh-TW.ts. I can see the repo has no pull-request CI workflow, so these will not run automatically. I will run the full gate list on a local checkout and report the output in this thread before you spend review time on it; if anything fails I will push fixes here.

Visual evidence

None yet. I could not run the app locally for this change and would rather not attach a mocked screenshot. The only new UI surface is the existing Settings → Interface language list, which gains a fourth row (繁 繁體中文). Glad to add real screenshots if you want them before merge.

Risks and compatibility

Additive and backward compatible: DEFAULT_UI_LOCALE stays zh-CN and previously stored locale values remain valid. Existing installs should restart Codex or reinstall the plugin so cached Skill/MCP metadata picks up the widened locale enum.

Known limitations and open questions:

  • Scenario and deck-category copy reuse the Simplified strings for zh-TW — readable, but not localized. Would you like a zh-TW field on LocalizedScenarioText as a follow-up?
  • src/app/layout.tsx still hardcodes lang="zh-CN" on <html>. That affects every locale, so it felt out of scope here.
  • Terminology follows Taiwan conventions, but 977 strings is a large surface: corrections on specific keys are very welcome, and I am happy to split this into smaller commits if that is easier to review.

Add support for Traditional Chinese localization by reusing Simplified Chinese text.
Add support for Traditional Chinese (Taiwan) in response language.
Added support for Traditional Chinese locale in QuestionCopyLocale type and resolutionQuestionCopy function.
Updated the README to include Traditional Chinese in the localized visual tutorial and UI language support.
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