Fix date picker not properly localized (#330)

* Fix language in date picker

Vuetify allows custom-named locales,
but the date-picker really only works with BCP 47 language tag

* Save lang at proper time + Update Vuetify lang on the fly
This commit is contained in:
sephrat
2021-04-21 18:36:49 +02:00
committed by GitHub
parent 8e27d0b83f
commit 29b9c231d3
4 changed files with 31 additions and 24 deletions

View File

@@ -1,7 +1,7 @@
import VueI18n from "../../i18n";
const state = {
lang: "en",
lang: "en-US",
allLangs: [
{
name: "English",
@@ -52,7 +52,12 @@ const mutations = {
const actions = {
initLang({ getters }, { currentVueComponent }) {
VueI18n.locale = getters.getActiveLang;
currentVueComponent.$vuetify.lang.current = getters.getActiveLang.replace('-', '_');
currentVueComponent.$vuetify.lang.current = getters.getActiveLang;
},
setLang({ commit }, { language, currentVueComponent }) {
VueI18n.locale = language;
currentVueComponent.$vuetify.lang.current = language;
commit('setLang', language);
},
};