Update for new API in react-sdk
We now get multiple languages from the browser as there may be a whole preference listpull/4035/head
parent
7636212bed
commit
003238c1e7
|
@ -313,9 +313,21 @@ async function loadApp() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadLanguage() {
|
async function loadLanguage() {
|
||||||
const lang = UserSettingsStore.getLocalSetting('language', languageHandler.getLanguageFromBrowser());
|
const prefLang = UserSettingsStore.getLocalSetting('language');
|
||||||
const languages = languageHandler.getNormalizedLanguageKeys(lang);
|
let langs = [];
|
||||||
languageHandler.setLanguage(languages);
|
|
||||||
|
if (!prefLang) {
|
||||||
|
languageHandler.getLanguagesFromBrowser().forEach((l) => {
|
||||||
|
langs.push(...languageHandler.getNormalizedLanguageKeys(l));
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
langs = [prefLang];
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await languageHandler.setLanguage(langs);
|
||||||
|
} catch (e) {
|
||||||
|
console.error("Unable to set language", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loadApp();
|
loadApp();
|
||||||
|
|
Loading…
Reference in New Issue