mirror of https://github.com/vector-im/riot-web
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() {
|
||||
const lang = UserSettingsStore.getLocalSetting('language', languageHandler.getLanguageFromBrowser());
|
||||
const languages = languageHandler.getNormalizedLanguageKeys(lang);
|
||||
languageHandler.setLanguage(languages);
|
||||
const prefLang = UserSettingsStore.getLocalSetting('language');
|
||||
let langs = [];
|
||||
|
||||
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();
|
||||
|
|
Loading…
Reference in New Issue