Skip to content

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

Merged
cxymds merged 1 commit into
rustfs:mainfrom
WWW5911:feat/add-zh-tw-locale
Nov 5, 2026
Merged

cxymds merged 1 commit into
rustfs:mainfrom
WWW5911:feat/add-zh-tw-locale

Conversation

@WWW5911

@WWW5911 WWW5911 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Pull Request

Description

Add Traditional Chinese (zh-TW) as a supported console locale.

  • Add i18n/locales/zh-TW.json, aligned 1:1 with en-US.json (2315 keys, same order, all {placeholders} preserved, Taiwan terminology).
  • Register zh-TW in LOCALE_FILE_MAP. zh-TW, zh_TW, zh-Hant, zh-Hant-TW, zh-HK, zh-MO resolve to it. zh, zh-CN, zh-Hans, zh-SG still resolve to Simplified Chinese.
  • Switch the i18next load option from "languageOnly" to "currentOnly". With languageOnly, i18next collapses zh-TW to zh and always serves Simplified Chinese. All other locale codes are already language-only, so they are unaffected.
  • Language switcher: label the existing option 簡體中文 and add 繁體中文. Resolve the current locale with normalizeLocale() instead of split("-")[0].
  • Date picker: use the date-fns zhTW locale for zh-TW.
  • README: list Traditional Chinese among the supported languages.

Type of Change

  • New feature (non-breaking change which adds functionality)

Testing

  • Unit tests added/updated
  • Manual testing completed

New tests:

  • tests/lib/i18n-config.test.js: Traditional Chinese variants resolve to zh-TW, Simplified variants stay on zh, and getLocaleFile("zh-TW") returns zh-TW.
  • tests/lib/datetime-picker.test.js: zh-TW maps to the date-fns zh-TW locale.

Run on Node 22 and pnpm 12.3.4 in an LF checkout (same as CI):

pnpm install --frozen-lockfile   # ok
pnpm type-check                  # ok
pnpm lint                        # ok
pnpm format:check                # ok
pnpm test:run                    # 869 passed, 0 failed

Checklist

  • Code follows the project's style guidelines
  • Self-review completed
  • TypeScript types are properly defined
  • All commit messages are in English (Conventional Commits)
  • All existing tests pass
  • No new dependencies added, or they are justified

Related Issues

Closes #

Screenshots (if applicable)

Before After
image image

Additional Notes

  • UI text change: the existing 中文 option is renamed to 簡體中文 so the two Chinese options can be told apart. Please confirm this is acceptable under the migration rule on page text changes.
  • zh-HK / zh-MO → zh-TW is a judgment call (closer script than Simplified Chinese). Easy to drop if not wanted.

Register zh-TW and route zh-TW/zh-Hant/zh-HK/zh-MO to it. Switch i18next
load to "currentOnly" because "languageOnly" collapses zh-TW to zh and
would always serve Simplified Chinese.
@cxymds
cxymds merged commit d8388f1 into rustfs:main Nov 5, 2026
10 checks passed
@WWW5911
WWW5911 deleted the feat/add-zh-tw-locale branch November 7, 2026 04:40
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