From e636ee513ef2eb3664997c981be03b649cf29e43 Mon Sep 17 00:00:00 2001 From: Giulio Date: Sat, 12 Jun 2021 11:11:48 +0200 Subject: [PATCH] change the language of the HTML document dynamically --- frontend/src/App.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 93da9a9..908258d 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -79,7 +79,8 @@ export default { // window.open(`${window.location.origin}/help`, '_blank') }, storeLangPref() { - localStorage.setItem('lang', this.$i18n.locale) + localStorage.setItem('lang', this.$i18n.locale); + document.documentElement.lang = this.$i18n.locale; }, async update() { this.showUpdateUI = false; @@ -108,7 +109,8 @@ export default { }, mounted() { if (localStorage.getItem('lang')) - this.$i18n.locale = localStorage.getItem('lang') + this.$i18n.locale = localStorage.getItem('lang'); + document.documentElement.lang = this.$i18n.locale; this.detectColorScheme() }, created() {