mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Update for new API in react-sdk
We now get multiple languages from the browser as there may be a whole preference list
This commit is contained in:
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
Block a user