feat(i18n): add Traditional Chinese (zh-TW) locale support#1132
feat(i18n): add Traditional Chinese (zh-TW) locale support#1132xne998808-ai wants to merge 1 commit intonexu-io:mainfrom
Conversation
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
There was a problem hiding this comment.
💡 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".
| const apiLocaleMap: Record<Locale, string> = { | ||
| en: "en", | ||
| zh: "zh-CN", | ||
| "zh-TW": "zh-TW", | ||
| }; |
There was a problem hiding this comment.
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 👍 / 👎.
|
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:
This looks production-ready. We'll review promptly (target: 24h). Questions or updates? Push here! Join communities:
Thanks for making Nexu better! |
Summary
Add full Traditional Chinese (繁體中文) UI support to the Nexu client.
apps/web/src/i18n/locales/zh-TW.ts— all 1190+ translation keys converted from Simplified Chinese via OpenCC s2twp (Taiwan-standard phrases)zh-TWresource added alongside existingenandzhnavigator.languageofzh-TWorzh-HKauto-selects Traditional ChineseresolveLocale()helper updated with optionalzh-TWkey support and fallback tozhsyncDesktopLocale()andbootstrapLocale()properly handlezh-TWround-tripChanged files
apps/web/src/i18n/locales/zh-TW.tsapps/web/src/i18n/index.tsapps/web/src/hooks/use-locale.tsxLocaletype, detection, sync, bootstrapapps/web/src/components/language-switcher.tsxapps/web/src/pages/models.tsxapps/desktop/src/lib/i18n.tsCloses #1120
Test plan
zh-TWlocale auto-detects Traditional Chinese on first load