Skip to content

feat(i18n): add traditional chinese (zh-tw) ui language - #7801

Closed
eviannaive wants to merge 2 commits into
stablyai:mainfrom
eviannaive:feat/traditional-chinese-ui-language
Closed

eviannaive wants to merge 2 commits into
stablyai:mainfrom
eviannaive:feat/traditional-chinese-ui-language

Conversation

@eviannaive

@eviannaive eviannaive commented Jul 8, 2026 •

Copy link
Copy Markdown

Summary

Adds Traditional Chinese (中文(繁體), zh-TW) as a UI language.

  • New zh-TW locale in the language picker (Settings → Appearance → Language).
  • System locales zh-TW / zh-HK / zh-MO / zh-Hant now resolve to the Traditional catalog instead of
    falling back to English.
  • The catalog is derived from the curated Simplified catalog via OpenCC (cn→twp, Taiwan phrasing:
    软件→軟體, 文件→檔案) with the new pnpm run bootstrap:zh-tw-catalog — deterministic, offline,
    byte-reproducible, and it inherits every existing glossary/brand repair instead of re-machine-translating
    ~10k strings from English.
  • pnpm run repair:locale-catalog regenerates zh-TW right after zh, keeping the locale inside the standard
    maintenance flow.
  • Catalogs stay lazy: zh-TW bundles as its own chunk, and load: 'currentOnly' keeps a zh-TW session from
    also fetching the Simplified catalog.

Screenshots

orca01 orca002

Testing

  • pnpm lint — all steps pass except lint:switch-exhaustiveness, which already fails on main in
    source-control-manual-review-url.ts (unrelated file, predates this PR)
  • pnpm typecheck
  • pnpm test — full vitest suite diffed against a clean HEAD baseline: zero regressions (the only
    failures are local-environment ones identical on the baseline)
  • pnpm build — zh-TW-*.js emitted as its own lazy chunk
  • pnpm run verify:localization-catalog — 10,190-key parity across all six catalogs
  • Manual (macOS): picker switch, native menu bar localization, system-locale detection, persistence
    across restart
  • Added or updated high-quality tests that would catch regressions: locale resolution
    (zh-TW/zh-HK/zh-MO/zh-Hant), lazy catalog loading (renderer + Electron main), and the settings
    language picker option.

AI Review Report

AI review (8 angles: line-by-line, removed-behavior audit, cross-file trace, reuse, simplification,
efficiency, altitude, conventions; adversarially verified) checked:

  • Cross-platform compatibility for macOS, Linux, and Windows: no platform-coupled logic; build scripts use
    path.join; no shortcuts, labels, or shell behavior changed.
  • SSH/remote/local compatibility: no assumptions about local execution; catalogs ship with the
    renderer/main bundles regardless of workspace backing.
  • Supported agent and integration compatibility: brand and product names (Orca, Claude, Codex, GitLab,
    Jira, …) are protected from translation by the policy tables, with a zh-TW-specific mistranslation table.
  • Performance risk: startup untouched (lazy chunk verified in build output); load: 'currentOnly' verified
    behavior-neutral for existing locales against i18next source; reviewer-found waste in the bootstrap script
    (double repair pass, per-call regex compilation) was fixed.
  • UI quality: native-label picker rendering verified in all six catalogs; full-scan shows zero
    Simplified-character leftovers and intact {{placeholders}}.

Review-found maintainability issues (zh-TW missing from the repair pipeline, duplicated CJK-spacing guards,
copy-pasted menu-label repairs) were fixed in this PR.

Security Audit

AI security review found no new input handling, command execution, auth, secrets, IPC, or path handling
risks. One new devDependency (opencc-js) is used at build time only; runtime changes are catalog data and
locale resolution. No follow-up security work needed.

Notes

  • Depends on chore(i18n): sync localization catalog for ssh dialog keys #7800 (its commit is included in this branch; will rebase once it merges).
  • Platform notes: none; behavior identical across macOS/Linux/Windows.
  • Remote/SSH notes: compatible with local and SSH-backed workspaces.
  • Git provider notes: no provider-specific behavior.
  • X/Twitter handle: not provided.

ELI5

Traditional Chinese (zh-TW) is a full UI language, including system locales like Hong Kong/Macau. The catalog is generated from Simplified Chinese with Taiwan phrasing.

Registers 21 translation keys referenced by ForgetSshWorkspaceDialog,
HostRemoveDialog, RemoveFolderDialog, and TerminalSshReconnectOverlay
(added in stablyai#7753) that were never synced into en.json, and repairs key
parity across all locale catalogs. Mechanical output of
`pnpm run sync:localization-catalog`; fixes the currently failing
verify:localization-catalog lint step on main.
Adds 中文(繁體) to the UI language picker, backed by a full zh-TW
catalog. System locales zh-TW / zh-HK / zh-MO / zh-Hant now resolve to
the Traditional catalog instead of falling back to English.

The catalog is derived from the curated Simplified catalog with OpenCC
(cn→twp, Taiwan phrasing: 软件→軟體, 文件→檔案) via the new
`pnpm run bootstrap:zh-tw-catalog`, so it inherits every existing
glossary/brand repair deterministically instead of re-machine-
translating from English. Catalogs load lazily per locale;
`load: 'currentOnly'` keeps a zh-TW session from also fetching the
Simplified catalog. BRAND_MISTRANSLATIONS moves to its own module to
stay under the max-lines ratchet.
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

An error occurred during the review process. Please try again later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This change adds Traditional Chinese (zh-TW) as a supported UI language. Shared locale utilities gain a new constant and normalization/resolution logic for zh-TW. Main and renderer i18n modules add lazy-loading support for the zh-TW catalog with a currentOnly load option. Appearance settings expose zh-TW as a selectable, searchable language. A new bootstrap script generates zh-TW.json from zh.json using OpenCC conversion, integrated into locale catalog repair tooling and package scripts. Brand mistranslation data is extracted into its own module, and translation policy repair logic is refactored. All locale catalogs receive new SSH/host removal dialog strings and a zh-TW label, with accompanying tests updated throughout.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding Traditional Chinese UI language support.
Description check ✅ Passed All required template sections are present, including screenshots, testing, AI review, security audit, and notes.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
config/scripts/repair-locale-catalog.mjs (1)

42-49: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Standalone --locale zh-TW runs silently depend on zh.json already being fresh.

The bootstrap branch regenerates zh-TW.json from whatever zh.json currently contains. That's correct when driven through DEFAULT_LOCALES (zh before zh-TW), but if someone runs node repair-locale-catalog.mjs --locale zh-TW directly, it will silently derive from a potentially stale zh.json with no warning.

Consider logging a note (or asserting recency) when zh-TW is repaired standalone, to prevent accidentally publishing a zh-TW catalog derived from stale Simplified Chinese data.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 555e7f7c-035b-4167-9aaa-aface2330572

📥 Commits

Reviewing files that changed from the base of the PR and between 745765b and a87c8fa.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (22)
  • config/scripts/bootstrap-zh-tw-catalog.mjs
  • config/scripts/locale-brand-mistranslations.mjs
  • config/scripts/locale-translation-policy.mjs
  • config/scripts/repair-locale-catalog.mjs
  • package.json
  • src/main/i18n/main-i18n-lazy-locale.test.ts
  • src/main/i18n/main-i18n.ts
  • src/renderer/src/components/settings/AppearancePane.test.tsx
  • src/renderer/src/components/settings/appearance-search.ts
  • src/renderer/src/i18n/i18n.ts
  • src/renderer/src/i18n/lazy-locale.test.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh-TW.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/i18n/supported-languages.ts
  • src/shared/ui-language.test.ts
  • src/shared/ui-language.ts
  • src/shared/ui-locale.test.ts
  • src/shared/ui-locale.ts

@AmethystLiang

Copy link
Copy Markdown
Contributor

Hi there, we'd like to support more languages! doing a bit refacotring in our i18n implementation so that we can easily support more.

give us a few days to land this PR

@AmethystLiang
AmethystLiang requested review from AmethystLiang and removed request for brennanb2025 July 12, 2026 04:28
@nwparker nwparker added the enhancement New feature or request label Jul 27, 2026
@nwparker

nwparker commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Thank you for putting this together — and I am sorry it sat unanswered for so long, which is on us, not you.

We are not taking on new UI locales right now. Orca ships en/es/ja/ko/zh, and each one carries ongoing cost beyond the initial catalog: every new English string has to be re-translated, the build-time repair policy needs per-locale glossary and override rules, and mistranslations reach users in surfaces nobody on the team can read. We are currently working through a backlog of correctness bugs in the five we already ship, and adding a sixth before that is under control would not be fair to the people using it.

That is a decision about our capacity, not about the quality of your work. Closing so the queue reflects reality rather than leaving it open indefinitely — if that changes, this is easy to reopen and we will come back to the contributors who offered first.

Thanks again for the time you put in.

@nwparker nwparker closed this Aug 4, 2026
@nwparker

nwparker commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

I'm sorry — I closed this, and that was the wrong call. Reopening it.

The reasoning I gave (that we aren't taking on new built-in locales right now) is still true, but closing your PR was not the right way to act on it. You did the work, it sat for months without a reply, and then it got closed with an explanation of our constraints. That's a bad trade for you, and I apologize.

Here's what's actually going on. We do want these locales. What we can't currently take on is maintaining them in-tree, where every new English string becomes translation debt across every catalog and a mistranslation ships to users in a surface nobody on the team can read. So the direction we're working toward is the one where that maintenance sits with the people who actually speak the language: plugin language packs.

Most of that mechanism is already in the repo today:

  • a plugin manifest declares contributes.languagePacks: [{ locale, path }]
  • the pack is a plain catalog JSON with the same key shape as src/renderer/src/i18n/locales/en.json
  • packs are content-integrity verified and approval-gated at install, then registered into i18next at runtime
  • they appear in Settings → Appearance → Language next to the built-in locales
  • Intl formatting — dates, relative times, number formats — resolves through the locale tag the pack declares

The test fixture for that manifest contract uses pt-BR as its worked example, so this isn't hypothetical plumbing.

What's not there yet is the part that would make this pleasant for you: there's no authoring guide, no scaffolding to generate a starter catalog from en.json, no re-sync story when English strings change, and the glossary/repair tooling we use for the built-in locales isn't exposed to pack authors. That's the work in front of us. I'm not going to give you a date I can't keep.

I'd rather leave this open and come back to you when that lands than close it and have you find out from a changelog. If you'd prefer to close it yourself in the meantime, that's entirely your call — but it should be yours, not mine.

Thanks for the work, and sorry again for how I handled it.

@OrcaWin

OrcaWin commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

Thank you for this! Traditional Chinese (Taiwan) is now a built-in UI language as of #29795: 繁體中文(台灣) in Settings → Appearance → Language. It's picked automatically for zh-TW, zh-HK, zh-MO and zh-Hant system locales, while zh-CN, zh-SG and zh-Hans stay on Simplified. Your work here fed into the terminology choices, including Taiwan wording like 電腦 and 分頁. Closing this one in favor of that PR. If you spot wording that reads wrong to a Taiwanese user, a follow-up PR against src/renderer/src/i18n/locales/zh-Hant.json (glossary in config/i18n-traditional-chinese.md) would be very welcome.

@OrcaWin OrcaWin closed this Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants