Skip to content

feat(web): add Traditional Chinese locale option#1142

Open
phoenixlucky wants to merge 2 commits intonexu-io:mainfrom
phoenixlucky:main
Open

feat(web): add Traditional Chinese locale option#1142
phoenixlucky wants to merge 2 commits intonexu-io:mainfrom
phoenixlucky:main

Conversation

@phoenixlucky
Copy link
Copy Markdown

What

Add a Traditional Chinese (zh-TW) option to the desktop/web language selector and wire it through frontend locale handling plus controller desktop preference persistence.

Why

Users could only choose English or Simplified Chinese. This adds an explicit Traditional Chinese option so locale preference can be selected, stored, and read back consistently across the app.

How

Added zh-TW as a first-class locale in the web i18n/bootstrap flow, language switchers, and settings UI.
Extended controller desktop preference schemas, config storage, and locale-aware runtime/fallback message paths to accept and preserve zh-TW.
For now, the main zh-TW translation file reuses existing Chinese strings as a minimal functional rollout, with a few runtime-only messages explicitly rendered in Traditional Chinese.

Affected areas

  • Desktop app (Electron shell)
  • Controller (backend / API)
  • Web dashboard (React UI)
  • OpenClaw runtime
  • Skills
  • Shared schemas / packages
  • Build / CI / Tooling

Checklist

  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes
  • pnpm generate-types run (if API routes/schemas changed)
  • No credentials or tokens in code or logs
  • No any types introduced (use unknown with narrowing)

Notes for reviewers

apps/web/src/i18n/locales/zh-TW.ts currently bootstraps from the existing Chinese locale object instead of introducing a full Traditional Chinese translation set. Review this as locale-plumbing first, not full copy localization.

I could not run pnpm typecheck, pnpm lint, or pnpm test in this environment because pnpm/corepack was blocked by local sandbox/network constraints.

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: cad7e3ad89

ℹ️ 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".

} from "../../lib/api/sdk.gen";

export type Locale = "en" | "zh";
export type Locale = "en" | "zh-CN" | "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.

P2 Badge Update downstream locale checks for new zh- codes*

Changing the locale domain to "zh-CN" | "zh-TW" breaks existing consumers that still expect the legacy "zh" value, which causes user-visible regressions in Chinese UI paths. For example, apps/web/src/lib/skill-translations.ts only translates tags when locale === "zh", so skills pages now always show raw English tags for both Chinese locales. Please normalize or update these checks when introducing the new locale codes.

Useful? React with 👍 / 👎.

@lefarcen lefarcen added the feature New feature request label Apr 17, 2026
Copy link
Copy Markdown
Collaborator

@lefarcen lefarcen left a comment

Choose a reason for hiding this comment

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

Hi @phoenixlucky! 🎉

Wow, what an impressive PR for adding Traditional Chinese (zh-TW) locale support—thank you for this thoughtful contribution! 🙌 The plumbing looks solid: clean schema updates, consistent type extensions across controller/web, proper fallback handling, and good locale detection logic. Love the minimal zh-TW rollout reusing zh-CN as a functional starting point.

A few quick thoughts:

  • Consider adding a few key zh-TW translations in apps/web/src/i18n/locales/zh-TW.ts beyond the current fallbacks (e.g., UI labels like "Settings" → "設定", "Models" → "模型") to make it feel more native right away.
  • In apps/web/src/hooks/use-locale.tsx, the localStorage migration from "zh" → "zh-CN" is great—maybe add a console.log for debugging in dev mode?
  • Since you couldn't run pnpm typecheck/lint/test due to sandbox constraints, please run them locally if possible and confirm they pass.

This looks great overall! 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

feature New feature request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants