feat(i18n): add Traditional Chinese (zh-TW) locale support#3995
feat(i18n): add Traditional Chinese (zh-TW) locale support#3995NkAntony777 wants to merge 1 commit into
Conversation
|
This is genuinely good work — it's a real Traditional translation, not a Simplified copy with a few swaps ( One blocker before it can merge: your own
Simplest fix — normalize separators once at the top so both forms (and func normalize(s string) string {
s = strings.ToLower(strings.TrimSpace(s))
s = strings.ReplaceAll(s, "_", "-") // zh_TW.UTF-8 → zh-tw.utf-8
if s == "" {
return ""
}
if strings.HasPrefix(s, "zh-tw") || strings.HasPrefix(s, "zh-hant") || strings.Contains(s, "chinese traditional") || strings.Contains(s, "繁體") {
return "zh-TW"
}
...(The frontend is fine as-is — Push that and CI should go green — happy to merge once it does. |
- Add zh-TW locale file with full Traditional Chinese translations (936 keys) - Add messages_zh_tw.go with zh-TW message catalogue (339 fields) - Update i18n.tsx: add zh-TW to Locale type, DICTS map, detectLocale(), normalizeLangPref(), and SPINNER_WORDS - Update bridge.ts: accept zh-TW in SetTrayLocale and MigrateDesktopPreferences - Fix normalize() to handle POSIX underscore form (zh_TW.UTF-8) by normalizing separators before prefix matching - Add zh-TW to catalog completeness, placeholder agreement, and normalize tests - Map zh-hk and zh-mo to zh-TW in frontend locale detection Fixes esengine#3898
58e6e2c to
6404cc4
Compare
|
Fixed. Added func normalize(s string) string {
s = strings.ToLower(strings.TrimSpace(s))
s = strings.ReplaceAll(s, "_", "-") // zh_TW.UTF-8 → zh-tw.utf-8
...All tests pass:
|
|
Thank you for this — the Taiwan terminology is genuinely well done. I rebased it onto current |
Summary
Changes
Frontend
Backend (CLI)
Locale Detection
The following locale strings are recognized as zh-TW:
zh-TW,zh_TW.UTF-8,zh-Hant-TW,zh-HantChinese Traditional,繁體Related Issue
Fixes #3898
Testing
npm run typecheck)