fix: unify chinese language code as zh-CN

This commit is contained in:
TerryM
2026-05-26 10:03:12 +08:00
parent f2e97c329e
commit f482a2ec38
13 changed files with 53 additions and 50 deletions

View File

@@ -34,8 +34,10 @@ export function resourceLanguageLabel(
): string {
const lc = langCode.trim().toLowerCase();
const normalized =
lc === "zh-cn" || lc === "zh-tw" || lc === "zh-hans" ? "zh" : lc;
const key = `lang_${normalized}`;
lc === "zh" || lc === "zh-cn" || lc === "zh-tw" || lc === "zh-hans"
? "zh-CN"
: lc;
const key = `lang_${normalized.replace("-", "_")}`;
const label = t(key);
return label !== key ? label : langCode.trim();
}