feat(i18n): add Traditional Chinese locale (#1360)
* feat: add Traditional Chinese locale * feat: add Traditional Chinese locale * feat(i18n): Update Traditional Chinese translation * fix(i18n): sync Traditional Chinese locale keys --------- Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
committed by
GitHub
co-authored by
Bohdan Triapitsyn
parent
5cde9ca88c
commit
6dbe7d0445
@@ -1,12 +1,13 @@
|
||||
export type Locale = 'en' | 'zh-CN' | 'uk' | 'es' | 'pt-BR' | 'ko' | 'pl';
|
||||
export type Locale = 'en' | 'zh-CN' | 'zh-TW' | 'uk' | 'es' | 'pt-BR' | 'ko' | 'pl';
|
||||
|
||||
export const LOCALES = ['en', 'zh-CN', 'uk', 'es', 'pt-BR', 'ko', 'pl'] as const satisfies readonly Locale[];
|
||||
export const LOCALES = ['en', 'zh-CN', 'zh-TW', 'uk', 'es', 'pt-BR', 'ko', 'pl'] as const satisfies readonly Locale[];
|
||||
|
||||
export const DEFAULT_LOCALE: Locale = 'en';
|
||||
|
||||
export const LOCALE_LABEL_KEYS: Record<Locale, 'common.language.english' | 'common.language.simplifiedChinese' | 'common.language.ukrainian' | 'common.language.spanish' | 'common.language.brazilianPortuguese' | 'common.language.korean' | 'common.language.polish'> = {
|
||||
export const LOCALE_LABEL_KEYS: Record<Locale, 'common.language.english' | 'common.language.simplifiedChinese' | 'common.language.traditionalChinese' | 'common.language.ukrainian' | 'common.language.spanish' | 'common.language.brazilianPortuguese' | 'common.language.korean' | 'common.language.polish'> = {
|
||||
en: 'common.language.english',
|
||||
'zh-CN': 'common.language.simplifiedChinese',
|
||||
'zh-TW': 'common.language.traditionalChinese',
|
||||
uk: 'common.language.ukrainian',
|
||||
es: 'common.language.spanish',
|
||||
'pt-BR': 'common.language.brazilianPortuguese',
|
||||
@@ -29,6 +30,9 @@ export function normalizeLocale(value: string | undefined | null): Locale {
|
||||
if (normalized === 'zh-cn' || normalized === 'zh-hans' || normalized.startsWith('zh-hans-')) {
|
||||
return 'zh-CN';
|
||||
}
|
||||
if (normalized === 'zh-tw' || normalized === 'zh-hant' || normalized.startsWith('zh-hant-')) {
|
||||
return 'zh-TW';
|
||||
}
|
||||
if (normalized.startsWith('zh')) {
|
||||
return 'zh-CN';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user