Try delay run localeTargetLanguages

This commit is contained in:
Lim Chee Aun 2024-09-10 12:32:55 +08:00
parent 162d344be1
commit 07e72be5bb

View file

@ -8,11 +8,12 @@ const locales = [
...navigator.languages,
];
const localeTargetLanguages = localeMatch(
locales,
translationTargetLanguages.map((l) => l.code.replace('_', '-')), // The underscore will fail Intl.Locale inside `match`
'en',
);
const localeTargetLanguages = () =>
localeMatch(
locales,
translationTargetLanguages.map((l) => l.code.replace('_', '-')), // The underscore will fail Intl.Locale inside `match`
'en',
);
function getTranslateTargetLanguage(fromSettings = false) {
if (fromSettings) {
@ -21,7 +22,7 @@ function getTranslateTargetLanguage(fromSettings = false) {
return contentTranslationTargetLanguage;
}
}
return localeTargetLanguages;
return localeTargetLanguages();
}
export default getTranslateTargetLanguage;