add zh-tw

This commit is contained in:
Henry Dollman
2025-01-14 19:56:36 -05:00
parent f24a7313d6
commit 73427306d1
4 changed files with 10 additions and 10 deletions

View File

@@ -24,6 +24,7 @@ const config: LinguiConfig = {
"sv",
"uk",
"vi",
"zh",
"zh-CN",
"zh-HK",
],

View File

@@ -2,7 +2,7 @@ import { $direction } from "./stores"
import { i18n } from "@lingui/core"
import type { Messages } from "@lingui/core"
import languages from "@/lib/languages"
import { detect, fromUrl, fromStorage, fromNavigator } from "@lingui/detect-locale"
import { detect, fromStorage, fromNavigator } from "@lingui/detect-locale"
import { messages as enMessages } from "@/locales/en/en.ts"
// let locale = detect(fromUrl("lang"), fromStorage("lang"), fromNavigator(), "en")
@@ -41,15 +41,10 @@ export async function dynamicActivate(locale: string) {
if (locale?.startsWith("zh-")) {
// map zh variants to zh-CN
const zhVariantMap: Record<string, string> = {
"zh-CN": "zh-CN",
"zh-SG": "zh-CN",
"zh-MY": "zh-CN",
zh: "zh-CN",
"zh-Hans": "zh-CN",
"zh-HK": "zh-HK",
"zh-TW": "zh-HK",
"zh-MO": "zh-HK",
"zh-Hant": "zh-HK",
"zh-TW": "zh",
"zh-MO": "zh",
"zh-Hant": "zh",
}
dynamicActivate(zhVariantMap[locale] || "zh-CN")
} else {

View File

@@ -119,4 +119,9 @@ export default [
label: "繁體中文",
e: "🇭🇰",
},
{
lang: "zh",
label: "繁體中文",
e: "🇹🇼",
},
] as const

View File

@@ -829,4 +829,3 @@ msgstr "YAML 設定檔"
#: src/components/routes/settings/layout.tsx:34
msgid "Your user settings have been updated."
msgstr "已更新您的使用者設定"