Update Chinese language support (#7878)

* Rename zh_hant to zh_Hant

* Fix front-end language mappings

* Remove "zh" code (is "zh_Hans")

* Remap backend translations

* Update frontend translation files

* Fix locale spec for front-end

* Update pt_BR for frontend translations

* Fix pt_BR for backend

* Rename es-mx to es_MX
This commit is contained in:
Oliver 2024-08-14 20:19:06 +10:00 committed by GitHub
parent 8369b4a44a
commit aed5516334
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 3212 additions and 27436 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@
"el",
"en",
"es",
"es-mx",
"es_MX",
"et",
"fa",
"fi",
@ -24,7 +24,7 @@
"no",
"pl",
"pt",
"pt-br",
"pt_BR",
"ro",
"ru",
"sk",
@ -35,8 +35,8 @@
"tr",
"uk",
"vi",
"zh-hans",
"zh-hant",
"zh_Hans",
"zh_Hant",
"pseudo-LOCALE"],
"catalogs": [{
"path": "src/locales/{locale}/messages",

View File

@ -25,7 +25,7 @@ export const getSupportedLanguages = (): Record<string, string> => {
el: t`Greek`,
en: t`English`,
es: t`Spanish`,
'es-mx': t`Spanish (Mexican)`,
es_MX: t`Spanish (Mexican)`,
et: t`Estonian`,
fa: t`Farsi / Persian`,
fi: t`Finnish`,
@ -41,7 +41,7 @@ export const getSupportedLanguages = (): Record<string, string> => {
no: t`Norwegian`,
pl: t`Polish`,
pt: t`Portuguese`,
'pt-br': t`Portuguese (Brazilian)`,
pt_BR: t`Portuguese (Brazilian)`,
ro: t`Romanian`,
ru: t`Russian`,
sk: t`Slovak`,
@ -51,8 +51,8 @@ export const getSupportedLanguages = (): Record<string, string> => {
tr: t`Turkish`,
uk: t`Ukrainian`,
vi: t`Vietnamese`,
'zh-hans': t`Chinese (Simplified)`,
'zh-hant': t`Chinese (Traditional)`
zh_Hans: t`Chinese (Simplified)`,
zh_Hant: t`Chinese (Traditional)`
};
};
@ -96,14 +96,17 @@ export function LanguageContext({ children }: { children: JSX.Element }) {
locales.push('en-us');
}
let new_locales = locales.join(', ');
// Ensure that the locales are properly formatted
let new_locales = locales
.map((locale) => locale?.replaceAll('_', '-').toLowerCase())
.join(', ');
if (new_locales == api.defaults.headers.common['Accept-Language']) {
return;
}
// Update default Accept-Language headers
api.defaults.headers.common['Accept-Language'] = locales.join(', ');
api.defaults.headers.common['Accept-Language'] = new_locales;
// Reload server state (and refresh status codes)
fetchGlobalStates();

File diff suppressed because it is too large Load Diff