Skip to content

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

Merged
Blankll merged 2 commits into
geek-fun:masterfrom
monarchsofchaos004-gif:add-zh-tw
Nov 11, 2026
Merged

Blankll merged 2 commits into
geek-fun:masterfrom
monarchsofchaos004-gif:add-zh-tw

Conversation

@monarchsofchaos004-gif

Copy link
Copy Markdown
Contributor

Adds a Traditional Chinese (Taiwan) UI translation, as discussed in #540.

  • Translated from the English source (not converted from zh-CN), with Taiwan terminology (e.g. 資料庫, 設定, 連線, 資料夾); technical terms such as Mappings stay in English.
  • The language picker gets a new 繁體中文 option; "Follow OS" now picks zh-TW for zh-TW / zh-HK / zh-Hant system locales.
  • zh-TW users get the Chinese reference docs (cn), since only en/cn exist.
  • Adds a key/placeholder parity test (tests/lang/zhTW.test.ts) so new English strings can't silently drift from this file.

Closes #540

@codecov

codecov Bot commented Nov 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 71.89%. Comparing base (62d5a17) to head (be16f80).

Files with missing lines Patch % Lines
src/lang/index.ts 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #542   +/-   ##
=======================================
  Coverage   71.88%   71.89%           
=======================================
  Files         168      169    +1     
  Lines       29729    29734    +5     
  Branches     1477     1479    +2     
=======================================
+ Hits        21372    21376    +4     
  Misses       7908     7908           
- Partials      449      450    +1     
Files with missing lines Coverage Δ
src/lang/enUS.ts 100.00% <ø> (ø)
src/lang/zhCN.ts 100.00% <ø> (ø)
src/lang/zhTW.ts 100.00% <100.00%> (ø)
src/store/appStore.ts 50.98% <100.00%> (+0.19%) ⬆️
src/lang/index.ts 95.00% <80.00%> (-5.00%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Blankll

Blankll commented Nov 11, 2026

Copy link
Copy Markdown
Member

nice work @monarchsofchaos004-gif ,thanks for contribution!

@Blankll
Blankll merged commit 19c49a9 into geek-fun:master Nov 11, 2026
9 checks passed
Blankll added a commit that referenced this pull request Nov 13, 2026
Follow-up on the review of #542 (zh-TW).

## Fix: language choice was never persisted

`getStoredLocale()` read `localStorage['lang']`, which nothing in the
codebase ever wrote — so a language picked in settings silently reverted
to OS auto-detection on the next launch. This was pre-existing (affected
zhCN too); for zh-TW users it was masked because auto-detection now
happens to resolve to `zhTW`.

`getStoredLocale()` now:
1. validates the `lang` value (previously cast unchecked),
2. falls back to the pinia-persisted `app.languageType`
(pinia-plugin-persistedstate default key = store id, verified from the
plugin source), so **existing users' past choices take effect
retroactively** — no picker change needed,
3. degrades gracefully to auto-detection on a corrupted blob.

## Tests

- `tests/lang/zhTW.test.ts` merged into `tests/lang/parity.test.ts`: key
parity + placeholder checks are now parametrized over `zhCN` / `zhTW`,
and both get **two-direction** assertions (en→locale and locale→en
no-extra-keys) — stronger than the previous zhCN one-direction check.
Adding a future locale is one array entry.
- `tests/lang/index.test.ts` extended with the behavior #542 introduced
but didn't cover: `it.each` over `zh-TW` / `zh-Hant-TW` / `zh-Hant` /
`zh-HK` / `zh-MO` → cn, bare `zh` / `en-US` → en, plus the three
persistence-fallback paths (valid `zhTW`, invalid value, corrupted
JSON).

## Verification

- `npx jest` — 70 suites / 1983 tests pass
- `npx tsc --noEmit` — clean
- `npx eslint` on changed files — clean
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.

Would a Traditional Chinese (Taiwan) translation be welcome?

2 participants