Skip to content

feat(i18n): add Traditional Chinese (zh-TW) locale support#1132

Open
xne998808-ai wants to merge 1 commit intonexu-io:mainfrom
xne998808-ai:feat/i18n-zh-tw
Open

feat(i18n): add Traditional Chinese (zh-TW) locale support#1132
xne998808-ai wants to merge 1 commit intonexu-io:mainfrom
xne998808-ai:feat/i18n-zh-tw

Conversation

@xne998808-ai
Copy link
Copy Markdown

Summary

Add full Traditional Chinese (繁體中文) UI support to the Nexu client.

  • New locale file: apps/web/src/i18n/locales/zh-TW.ts — all 1190+ translation keys converted from Simplified Chinese via OpenCC s2twp (Taiwan-standard phrases)
  • i18next registration: zh-TW resource added alongside existing en and zh
  • Locale detection: Browser navigator.language of zh-TW or zh-HK auto-selects Traditional Chinese
  • Language switcher: Both the Welcome page dropdown and Settings page selector now show three options: English / 简体中文 / 繁體中文
  • Desktop renderer: resolveLocale() helper updated with optional zh-TW key support and fallback to zh
  • Desktop sync: syncDesktopLocale() and bootstrapLocale() properly handle zh-TW round-trip

Changed files

File Change
apps/web/src/i18n/locales/zh-TW.ts New — full Traditional Chinese translation
apps/web/src/i18n/index.ts Register zh-TW resource, update detection
apps/web/src/hooks/use-locale.tsx Extend Locale type, detection, sync, bootstrap
apps/web/src/components/language-switcher.tsx Add 繁體中文 option
apps/web/src/pages/models.tsx Add 繁體中文 to settings language selector
apps/desktop/src/lib/i18n.ts Support zh-TW in desktop renderer helper

Closes #1120

Test plan

  • Switch language to 繁體中文 in Welcome page language switcher
  • Switch language to 繁體中文 in Settings → General → Language
  • Verify browser with zh-TW locale auto-detects Traditional Chinese on first load
  • Switch between English → 简体中文 → 繁體中文 — no rendering issues
  • Refresh page after selecting 繁體中文 — locale persists via localStorage

Add full Traditional Chinese (繁體中文) support to the client UI.

- Create `zh-TW.ts` translation file (converted from zh-CN via OpenCC s2twp)
- Register zh-TW resource in i18next init
- Extend Locale type to include "zh-TW"
- Auto-detect zh-TW/zh-HK browser locale
- Add "繁體中文" option to language switcher and settings page
- Update desktop renderer i18n helper with zh-TW fallback

Closes nexu-io#1120

Made-with: Cursor
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a0534676b1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +103 to +107
const apiLocaleMap: Record<Locale, string> = {
en: "en",
zh: "zh-CN",
"zh-TW": "zh-TW",
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Persist zh-TW using a controller-supported locale

syncDesktopLocale() now posts "zh-TW" to /api/internal/desktop/preferences, but the controller endpoint and store still only accept "en" | "zh-CN" (see apps/controller/src/routes/desktop-routes.ts and apps/controller/src/store/nexu-config-store.ts). For users who pick Traditional Chinese (or are auto-detected as zh-TW/zh-HK), that PATCH call fails and is swallowed, so the desktop preference never persists and controller-side locale-dependent behavior stays on the old locale. This breaks the claimed zh-TW round-trip and should be fixed by mapping zh-TW to a supported persisted value or by extending backend locale enums first.

Useful? React with 👍 / 👎.

@lefarcen
Copy link
Copy Markdown
Collaborator

Hi @xne998808-ai! 🎉

Wow, what an impressive PR for full Traditional Chinese (zh-TW) support—thank you for this thoughtful contribution! The comprehensive translation (1190+ keys!), locale detection, and test plan show real care for our global users. 🙌

A few quick thoughts:

  • Great OpenCC usage and Taiwan-standard phrasing!
  • Love the localStorage persistence and desktop sync.
  • Consider adding a quick CI check for translation completeness?

This looks production-ready. We'll review promptly (target: 24h). Questions or updates? Push here!

Join communities:

Thanks for making Nexu better!
Nexu Team

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.

希望支持繁体中文客户端

2 participants