Skip to content

feat(i18n): add Traditional Chinese (zh-TW) language support#22

Merged
ntd4996 merged 1 commit into
ntd4996:mainfrom
aiexkwan:feat/add-traditional-chinese-i18n
Jun 16, 2026
Merged

feat(i18n): add Traditional Chinese (zh-TW) language support#22
ntd4996 merged 1 commit into
ntd4996:mainfrom
aiexkwan:feat/add-traditional-chinese-i18n

Conversation

@aiexkwan

Copy link
Copy Markdown
Contributor

Summary

  • Add 正體中文 (Traditional Chinese / zh-TW) as a new language option across all three platforms
  • Web (Astro): 349 translated entries in dict.ts, language switcher buttons (desktop dropdown + mobile segmented control), browser auto-detection for zh-TW / zh-HK / zh-MO locales, HTML lang="zh-Hant" mapping
  • Windows (TypeScript): 220 translated entries in i18n.ts, localStorage persistence and browser language detection
  • macOS (Swift): new zh-Hant.lproj/Localizable.strings with 334 entries

Translations were converted from the existing Simplified Chinese entries using OpenCC with the s2twp profile (Simplified → Traditional with Taiwan phrase adjustments).

Details

Language detection logic

  • Browser navigator.language values zh-TW, zh-HK, zh-MO, and zh-Hant* → mapped to zh-TW
  • All other zh-* values → mapped to zh (Simplified Chinese, unchanged)
  • User choice persisted in localStorage and restored on next visit

Files changed

File Change
web/src/i18n/dict.ts Updated Lang type, LANGS array, DICT Record; added zh-TW translation block
web/src/layouts/Base.astro Added switcher buttons, updated LANGS/HTML_LANG/SHORT/detect() in inline JS
windows/src/i18n.ts Updated Lang type; added zh-TW translation block and browser detection
Localizations/zh-Hant.lproj/Localizable.strings New file — macOS Traditional Chinese strings

Test plan

  • Web: switch to 正體中文 via language dropdown → all UI text renders in Traditional Chinese
  • Web: browser with zh-TW locale auto-detects Traditional Chinese on first visit
  • Web: browser with zh-HK locale auto-detects Traditional Chinese
  • Web: browser with zh-CN locale still shows Simplified Chinese (unchanged)
  • Web: language choice persists across page reloads via localStorage
  • Windows: zh-TW translation entries render correctly in settings UI
  • macOS: zh-Hant.lproj/Localizable.strings recognized by Xcode / Swift runtime

🤖 Generated with Claude Code

Add 正體中文 (Traditional Chinese) as a new language option across all
three platforms: web (Astro), Windows (TypeScript), and macOS (Swift).

- Web: 349 translated entries in dict.ts, language switcher buttons,
  browser auto-detection for zh-TW/zh-HK/zh-MO locales
- Windows: 220 translated entries in i18n.ts, localStorage and
  browser language detection
- macOS: new zh-Hant.lproj/Localizable.strings with 334 entries

Translations converted from existing Simplified Chinese using OpenCC
s2twp (Simplified → Traditional with Taiwan phrases).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ntd4996 ntd4996 merged commit 8b00007 into ntd4996:main Jun 16, 2026
1 check passed
@ntd4996

ntd4996 commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Merged, thank you, 正體中文 support across web, Windows and macOS in one PR is great, and converting from Simplified via OpenCC s2twp was a smart approach. One small thing I added on top: the macOS side needed wiring into the language picker (a new AppLanguage.Lang case + CFBundleLocalizations entry + relabelling 中文 → 简体中文/繁體中文) so the new zh-Hant.lproj is actually selectable in Settings, pushed that as a follow-up. Everything builds, 581 tests green. Appreciated! 🙏

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