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", "sv",
"uk", "uk",
"vi", "vi",
"zh",
"zh-CN", "zh-CN",
"zh-HK", "zh-HK",
], ],

View File

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

View File

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

View File

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