fix: change the ui locale

This commit is contained in:
kolaente 2021-10-17 14:01:15 +02:00
parent 74d785d606
commit 2fc96cb6a7
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -21,14 +21,15 @@ export const availableLanguages = {
const loadedLanguages = ['en'] // our default language that is preloaded const loadedLanguages = ['en'] // our default language that is preloaded
const setI18nLanguage = lang => { const setI18nLanguage = lang => {
i18n.locale = lang i18n.global.locale = lang
document.querySelector('html').setAttribute('lang', lang) document.querySelector('html').setAttribute('lang', lang)
return lang return lang
} }
export const loadLanguageAsync = lang => { export const loadLanguageAsync = lang => {
console.log(lang, i18n.global.locale)
// If the same language // If the same language
if (i18n.locale === lang) { if (i18n.global.locale === lang) {
return Promise.resolve(setI18nLanguage(lang)) return Promise.resolve(setI18nLanguage(lang))
} }