From 419b58e656bcdf392c4a753764c5754ffec07195 Mon Sep 17 00:00:00 2001 From: Florian Dupret <34862846+sephrat@users.noreply.github.com> Date: Tue, 20 Apr 2021 09:10:17 +0200 Subject: [PATCH] Make vuetify locales match with new VueI18n standard --- frontend/src/plugins/vuetify.js | 24 ++++++++++++++++++------ frontend/src/store/modules/language.js | 2 +- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/frontend/src/plugins/vuetify.js b/frontend/src/plugins/vuetify.js index 1e8c87b6b..522f30fd3 100644 --- a/frontend/src/plugins/vuetify.js +++ b/frontend/src/plugins/vuetify.js @@ -3,11 +3,16 @@ import Vuetify from "vuetify/lib"; Vue.use(Vuetify); +// language IDs should match those from VueI18n with _ instead of - +import de_DE from 'vuetify/es5/locale/de'; +import en_US from 'vuetify/es5/locale/en'; +import fr_FR from 'vuetify/es5/locale/fr'; +import pl_PL from 'vuetify/es5/locale/pl'; +import pt_PT from 'vuetify/es5/locale/pt'; +import sv_SE from 'vuetify/es5/locale/sv'; +import zh_CN from 'vuetify/es5/locale/zh-Hans'; +import zh_TW from 'vuetify/es5/locale/zh-Hant'; -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({ theme: { @@ -37,9 +42,16 @@ const vuetify = new Vuetify({ }, lang: { locales: { - fr, pl, sv, de + de_DE, + en_US, + fr_FR, + pl_PL, + pt_PT, + sv_SE, + zh_CN, + zh_TW }, - current: 'en', + current: 'en_US', }, }); diff --git a/frontend/src/store/modules/language.js b/frontend/src/store/modules/language.js index 50b3a8e83..963cfb1ae 100644 --- a/frontend/src/store/modules/language.js +++ b/frontend/src/store/modules/language.js @@ -52,7 +52,7 @@ const mutations = { const actions = { initLang({ getters }, { currentVueComponent }) { VueI18n.locale = getters.getActiveLang; - currentVueComponent.$vuetify.lang.current = getters.getActiveLang; + currentVueComponent.$vuetify.lang.current = getters.getActiveLang.replace('-', '_'); }, };