i18n: fallback to french
This commit is contained in:
parent
6e2738bd97
commit
c279bffcaf
@ -16,7 +16,7 @@ class JsI18n {
|
||||
this.setLocale(localStorage.getItem('language') || window.navigator.language.slice(0, 2));
|
||||
} else {
|
||||
console.error('Language not found');
|
||||
this.setLocale('en');
|
||||
this.setLocale('fr');
|
||||
}
|
||||
};
|
||||
|
||||
@ -105,14 +105,21 @@ class JsI18n {
|
||||
result.json().then(e => {
|
||||
this.addLocale(locale, e);
|
||||
this.processPage();
|
||||
}).catch(() => {
|
||||
if (locale != "fr") {
|
||||
console.warn(`Locale not found: ${locale}, fallback to french`);
|
||||
this.setLocale("fr");
|
||||
} else {
|
||||
console.error("Language not found");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
this.locale = locale;
|
||||
} catch {
|
||||
if (locale != "en") {
|
||||
console.warn(`Locale not found: ${locale}, fallback to english`);
|
||||
this.setLocale("en");
|
||||
if (locale != "fr") {
|
||||
console.warn(`Locale not found: ${locale}, fallback to french`);
|
||||
this.setLocale("fr");
|
||||
} else {
|
||||
console.error("Language not found");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user