change the language of the HTML document dynamically

This commit is contained in:
Giulio 2021-06-12 11:11:48 +02:00
parent a506e0245d
commit e636ee513e

View File

@ -79,7 +79,8 @@ export default {
// window.open(`${window.location.origin}/help`, '_blank') // window.open(`${window.location.origin}/help`, '_blank')
}, },
storeLangPref() { storeLangPref() {
localStorage.setItem('lang', this.$i18n.locale) localStorage.setItem('lang', this.$i18n.locale);
document.documentElement.lang = this.$i18n.locale;
}, },
async update() { async update() {
this.showUpdateUI = false; this.showUpdateUI = false;
@ -108,7 +109,8 @@ export default {
}, },
mounted() { mounted() {
if (localStorage.getItem('lang')) if (localStorage.getItem('lang'))
this.$i18n.locale = localStorage.getItem('lang') this.$i18n.locale = localStorage.getItem('lang');
document.documentElement.lang = this.$i18n.locale;
this.detectColorScheme() this.detectColorScheme()
}, },
created() { created() {