Use embedded Vuetify locales

This commit is contained in:
Florian Dupret 2021-03-16 08:56:02 +01:00
commit be88fdbbc4
4 changed files with 15 additions and 4 deletions

View file

@ -70,7 +70,7 @@ export default {
this.search = !this.search; this.search = !this.search;
} }
}); });
this.$store.dispatch("initLang"); this.$store.dispatch("initLang", { currentVueComponent: this });
}, },
mounted() { mounted() {

View file

@ -30,7 +30,6 @@
<v-date-picker <v-date-picker
v-model="startDate" v-model="startDate"
no-title no-title
:locale="$i18n.locale"
@input="menu2 = false" @input="menu2 = false"
></v-date-picker> ></v-date-picker>
</v-menu> </v-menu>
@ -59,7 +58,6 @@
<v-date-picker <v-date-picker
v-model="endDate" v-model="endDate"
no-title no-title
:locale="$i18n.locale"
@input="menu2 = false" @input="menu2 = false"
></v-date-picker> ></v-date-picker>
</v-menu> </v-menu>

View file

@ -3,6 +3,12 @@ import Vuetify from "vuetify/lib";
Vue.use(Vuetify); Vue.use(Vuetify);
import fr from 'vuetify/es5/locale/fr';
import pl from 'vuetify/es5/locale/pl';
import sv from 'vuetify/es5/locale/sv';
import de from 'vuetify/es5/locale/de';
const vuetify = new Vuetify({ const vuetify = new Vuetify({
theme: { theme: {
dark: false, dark: false,
@ -29,6 +35,12 @@ const vuetify = new Vuetify({
}, },
}, },
}, },
lang: {
locales: {
fr, pl, sv, de
},
current: 'en',
},
}); });
export default vuetify; export default vuetify;

View file

@ -46,8 +46,9 @@ const mutations = {
}; };
const actions = { const actions = {
initLang({ getters }) { initLang({ getters }, { currentVueComponent }) {
VueI18n.locale = getters.getActiveLang; VueI18n.locale = getters.getActiveLang;
currentVueComponent.$vuetify.lang.current = getters.getActiveLang;
}, },
}; };