fix: change the ui locale
This commit is contained in:
parent
74d785d606
commit
2fc96cb6a7
1 changed files with 3 additions and 2 deletions
|
@ -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))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue