mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
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:
parent
8369b4a44a
commit
aed5516334
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,7 @@
|
|||||||
"el",
|
"el",
|
||||||
"en",
|
"en",
|
||||||
"es",
|
"es",
|
||||||
"es-mx",
|
"es_MX",
|
||||||
"et",
|
"et",
|
||||||
"fa",
|
"fa",
|
||||||
"fi",
|
"fi",
|
||||||
@ -24,7 +24,7 @@
|
|||||||
"no",
|
"no",
|
||||||
"pl",
|
"pl",
|
||||||
"pt",
|
"pt",
|
||||||
"pt-br",
|
"pt_BR",
|
||||||
"ro",
|
"ro",
|
||||||
"ru",
|
"ru",
|
||||||
"sk",
|
"sk",
|
||||||
@ -35,8 +35,8 @@
|
|||||||
"tr",
|
"tr",
|
||||||
"uk",
|
"uk",
|
||||||
"vi",
|
"vi",
|
||||||
"zh-hans",
|
"zh_Hans",
|
||||||
"zh-hant",
|
"zh_Hant",
|
||||||
"pseudo-LOCALE"],
|
"pseudo-LOCALE"],
|
||||||
"catalogs": [{
|
"catalogs": [{
|
||||||
"path": "src/locales/{locale}/messages",
|
"path": "src/locales/{locale}/messages",
|
||||||
|
@ -25,7 +25,7 @@ export const getSupportedLanguages = (): Record<string, string> => {
|
|||||||
el: t`Greek`,
|
el: t`Greek`,
|
||||||
en: t`English`,
|
en: t`English`,
|
||||||
es: t`Spanish`,
|
es: t`Spanish`,
|
||||||
'es-mx': t`Spanish (Mexican)`,
|
es_MX: t`Spanish (Mexican)`,
|
||||||
et: t`Estonian`,
|
et: t`Estonian`,
|
||||||
fa: t`Farsi / Persian`,
|
fa: t`Farsi / Persian`,
|
||||||
fi: t`Finnish`,
|
fi: t`Finnish`,
|
||||||
@ -41,7 +41,7 @@ export const getSupportedLanguages = (): Record<string, string> => {
|
|||||||
no: t`Norwegian`,
|
no: t`Norwegian`,
|
||||||
pl: t`Polish`,
|
pl: t`Polish`,
|
||||||
pt: t`Portuguese`,
|
pt: t`Portuguese`,
|
||||||
'pt-br': t`Portuguese (Brazilian)`,
|
pt_BR: t`Portuguese (Brazilian)`,
|
||||||
ro: t`Romanian`,
|
ro: t`Romanian`,
|
||||||
ru: t`Russian`,
|
ru: t`Russian`,
|
||||||
sk: t`Slovak`,
|
sk: t`Slovak`,
|
||||||
@ -51,8 +51,8 @@ export const getSupportedLanguages = (): Record<string, string> => {
|
|||||||
tr: t`Turkish`,
|
tr: t`Turkish`,
|
||||||
uk: t`Ukrainian`,
|
uk: t`Ukrainian`,
|
||||||
vi: t`Vietnamese`,
|
vi: t`Vietnamese`,
|
||||||
'zh-hans': t`Chinese (Simplified)`,
|
zh_Hans: t`Chinese (Simplified)`,
|
||||||
'zh-hant': t`Chinese (Traditional)`
|
zh_Hant: t`Chinese (Traditional)`
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -96,14 +96,17 @@ export function LanguageContext({ children }: { children: JSX.Element }) {
|
|||||||
locales.push('en-us');
|
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']) {
|
if (new_locales == api.defaults.headers.common['Accept-Language']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update default Accept-Language headers
|
// 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)
|
// Reload server state (and refresh status codes)
|
||||||
fetchGlobalStates();
|
fetchGlobalStates();
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user