Localized new ui to zh-TW (#5942)

* Create zh-TW.json

* Update _sync-report.json

* Update languages.ts

* Update config.ts

* fix(i18n): update language codes and improve translations for zh-CN and zh-TW
This commit is contained in:
Meow Tech Open Source by NovaMeow
2026-07-07 12:46:02 +08:00
committed by GitHub
parent 70ea899e37
commit d1abf78ec0
5 changed files with 5085 additions and 8 deletions
+1 -1
View File
@@ -39,7 +39,7 @@ export function LanguageSwitcher() {
const { i18n, t } = useTranslation()
const user = useAuthStore((s) => s.auth.user)
const currentLanguage = normalizeInterfaceLanguage(i18n.language)
console.log('Current interface language: %s', currentLanguage)
const handleChangeLanguage = useCallback(
async (code: string) => {
await i18n.changeLanguage(code)
+6 -4
View File
@@ -25,15 +25,17 @@ import fr from './locales/fr.json'
import ja from './locales/ja.json'
import ru from './locales/ru.json'
import vi from './locales/vi.json'
import zh from './locales/zh.json'
import zhCN from './locales/zh.json'
import zhTW from './locales/zh-TW.json'
export const resources = {
en,
zh,
zhCN,
fr,
ru,
ja,
vi,
zhTW
} as const
i18n
@@ -42,8 +44,8 @@ i18n
.init({
resources,
fallbackLng: 'en',
supportedLngs: ['en', 'zh', 'fr', 'ru', 'ja', 'vi'],
load: 'languageOnly', // Convert zh-CN -> zh
supportedLngs: ['en', 'zhCN', 'fr', 'ru', 'ja', 'vi','zhTW'],
load: 'currentOnly', // Convert zh-CN -> zh
nsSeparator: false, // Allow literal colons in keys (e.g., URLs, labels)
debug: import.meta.env.DEV,
interpolation: {
+10 -3
View File
@@ -18,12 +18,13 @@ For commercial licensing, please contact support@quantumnous.com
*/
export const INTERFACE_LANGUAGE_OPTIONS = [
{ code: 'zh', label: '简体中文' },
{ code: 'zhCN', label: '简体中文' },
{ code: 'en', label: 'English' },
{ code: 'fr', label: 'Français' },
{ code: 'ru', label: 'Русский' },
{ code: 'ja', label: '日本語' },
{ code: 'vi', label: 'Tiếng Việt' },
{ code: 'zhTW', label: '繁體中文' }
] as const
export type InterfaceLanguageCode =
@@ -32,9 +33,15 @@ export type InterfaceLanguageCode =
export function normalizeInterfaceLanguage(value?: string | null): string {
if (!value) return 'en'
const normalized = value.trim().replace(/_/g, '-').toLowerCase()
if (normalized.startsWith('zh')) return 'zh'
var normalized = value.trim().replace(/_/g, '-').toLowerCase()
if (value === 'zh-TW' || value === 'zh-HK' || value === 'zh-MO' || value === 'zhTW') {
normalized = 'zhTW'
}
if (value === 'zh-CN' || value === 'zh-Hans' || value === "zhCN") {
normalized = 'zhCN'
}
console.log('Normalized interface language: %s -> %s', value, normalized)
return INTERFACE_LANGUAGE_OPTIONS.some((lang) => lang.code === normalized)
? normalized
: 'en'
@@ -36,6 +36,12 @@
"missingCount": 0,
"extrasCount": 0,
"untranslatedCount": 0
},
"zh-TW": {
"file": "zh-TW.json",
"missingCount": 0,
"extrasCount": 0,
"untranslatedCount": 0
}
}
}
File diff suppressed because it is too large Load Diff