diff --git a/beszel/site/lingui.config.ts b/beszel/site/lingui.config.ts index 0377e0e..aa8a6b5 100644 --- a/beszel/site/lingui.config.ts +++ b/beszel/site/lingui.config.ts @@ -24,6 +24,7 @@ const config: LinguiConfig = { "sv", "uk", "vi", + "zh", "zh-CN", "zh-HK", ], diff --git a/beszel/site/src/lib/i18n.ts b/beszel/site/src/lib/i18n.ts index e49745a..54f0e50 100644 --- a/beszel/site/src/lib/i18n.ts +++ b/beszel/site/src/lib/i18n.ts @@ -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 = { - "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 { diff --git a/beszel/site/src/lib/languages.ts b/beszel/site/src/lib/languages.ts index fff0adc..1a1ea0d 100644 --- a/beszel/site/src/lib/languages.ts +++ b/beszel/site/src/lib/languages.ts @@ -119,4 +119,9 @@ export default [ label: "繁體中文", e: "🇭🇰", }, + { + lang: "zh", + label: "繁體中文", + e: "🇹🇼", + }, ] as const diff --git a/beszel/site/src/locales/zh/zh.po b/beszel/site/src/locales/zh/zh.po index cd6b144..86a0851 100644 --- a/beszel/site/src/locales/zh/zh.po +++ b/beszel/site/src/locales/zh/zh.po @@ -829,4 +829,3 @@ msgstr "YAML 設定檔" #: src/components/routes/settings/layout.tsx:34 msgid "Your user settings have been updated." msgstr "已更新您的使用者設定" -