Skip to content
Snippets Groups Projects
Commit 8d1a142e authored by Henrik Askjer's avatar Henrik Askjer
Browse files

fix locale bug on reload

parent b0333ddd
No related branches found
No related tags found
No related merge requests found
...@@ -73,13 +73,6 @@ import TopBar from './components/TopBar.vue' ...@@ -73,13 +73,6 @@ import TopBar from './components/TopBar.vue'
} }
document.title = 'Ordbøkene - ' + process.env.VUE_APP_VERSION_LABEL document.title = 'Ordbøkene - ' + process.env.VUE_APP_VERSION_LABEL
}, },
methods: {
choose_locale: function(locale) {
this.locale_chosen = true
this.$store.commit("setLocale", {value: locale, i18n: this._i18n})
}
},
components: { components: {
TopBar TopBar
} }
......
...@@ -112,10 +112,14 @@ const store = new Vuex.Store({ ...@@ -112,10 +112,14 @@ const store = new Vuex.Store({
else if (locale == "nb") state.currentLocale = "nob" else if (locale == "nb") state.currentLocale = "nob"
} }
if (state.currentLocale) {
i18n.locale = state.currentLocale
}
}, },
setLocale(state, payload) { setLocale(state, payload) {
state.currentLocale = payload.value state.currentLocale = payload.value
payload.i18n.locale = payload.value i18n.locale = payload.value
localStorage.setItem("currentLocale", payload.value); localStorage.setItem("currentLocale", payload.value);
}, },
setCollapse(state, value) { setCollapse(state, value) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment