diff --git a/frontend/src/components/Admin/General/HomePageSettings.vue b/frontend/src/components/Admin/General/HomePageSettings.vue index 6345db60..58eb945a 100644 --- a/frontend/src/components/Admin/General/HomePageSettings.vue +++ b/frontend/src/components/Admin/General/HomePageSettings.vue @@ -211,7 +211,6 @@ export default { methods: { writeLang(val) { - this.$store.commit("setLang", val); this.settings.language = val; }, deleteCategoryfromDatabase(category) { @@ -225,7 +224,9 @@ export default { }, async saveSettings() { await api.siteSettings.update(this.settings); - this.$store.commit("setLang", this.settings.language); + this.$store.dispatch("setLang", { + currentVueComponent: this, + language: this.settings.language }); this.getOptions(); }, }, diff --git a/frontend/src/components/UI/LanguageMenu.vue b/frontend/src/components/UI/LanguageMenu.vue index 6038bbc3..4be3a31d 100644 --- a/frontend/src/components/UI/LanguageMenu.vue +++ b/frontend/src/components/UI/LanguageMenu.vue @@ -47,7 +47,7 @@ export default { items: [ { name: "English", - value: "en", + value: "en-US", }, ], }; @@ -72,7 +72,9 @@ export default { if (this.siteSettings) { this.$emit(SELECT_EVENT, selectedLanguage); } else { - this.$store.commit("setLang", selectedLanguage); + this.$store.dispatch("setLang", { + currentVueComponent: this, + language: selectedLanguage }); } }, }, diff --git a/frontend/src/plugins/vuetify.js b/frontend/src/plugins/vuetify.js index 522f30fd..368c9a68 100644 --- a/frontend/src/plugins/vuetify.js +++ b/frontend/src/plugins/vuetify.js @@ -3,15 +3,14 @@ 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 de from 'vuetify/es5/locale/de'; +import en from 'vuetify/es5/locale/en'; +import fr from 'vuetify/es5/locale/fr'; +import pl from 'vuetify/es5/locale/pl'; +import pt from 'vuetify/es5/locale/pt'; +import sv from 'vuetify/es5/locale/sv'; +import zhHans from 'vuetify/es5/locale/zh-Hans'; +import zhHant from 'vuetify/es5/locale/zh-Hant'; const vuetify = new Vuetify({ @@ -42,16 +41,16 @@ const vuetify = new Vuetify({ }, lang: { locales: { - de_DE, - en_US, - fr_FR, - pl_PL, - pt_PT, - sv_SE, - zh_CN, - zh_TW + 'de-DE' : de, + 'en-US' : en, + 'fr-FR' : fr, + 'pl-PL' : pl, + 'pt-PT' : pt, + 'sv-SE' : sv, + 'zh-CN' : zhHans, + 'zh-TW' : zhHant }, - current: 'en_US', + current: 'en-US', }, }); diff --git a/frontend/src/store/modules/language.js b/frontend/src/store/modules/language.js index 963cfb1a..431070a8 100644 --- a/frontend/src/store/modules/language.js +++ b/frontend/src/store/modules/language.js @@ -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); }, };