diff --git a/src/renderer/main.js b/src/renderer/main.js index ca511904..25ea026c 100644 --- a/src/renderer/main.js +++ b/src/renderer/main.js @@ -9,7 +9,7 @@ import App from '@/App.vue'; import store from '@/store'; import i18n from '@/i18n'; -i18n.locale = store.state.application.locale; +i18n.locale = store.state.settings.locale; Vue.config.productionTip = false; new Vue({ diff --git a/src/renderer/store/index.js b/src/renderer/store/index.js index 2e209b03..a12a8bf8 100644 --- a/src/renderer/store/index.js +++ b/src/renderer/store/index.js @@ -5,6 +5,7 @@ import Vuex from 'vuex'; import VuexPersist from 'vuex-persist'; import application from './modules/application.store'; +import settings from './modules/settings.store'; import connections from './modules/connections.store'; import workspaces from './modules/workspaces.store'; import notifications from './modules/notifications.store'; @@ -13,7 +14,8 @@ const vuexLocalStorage = new VuexPersist({ key: 'application', // The key to store the state on in the storage provider. storage: window.localStorage, reducer: state => ({ - connections: state.connections + connections: state.connections, + settings: state.settings }) }); @@ -23,6 +25,7 @@ export default new Vuex.Store({ strict: true, modules: { application, + settings, connections, workspaces, notifications diff --git a/src/renderer/store/modules/application.store.js b/src/renderer/store/modules/application.store.js index a9b34c92..38cc03c9 100644 --- a/src/renderer/store/modules/application.store.js +++ b/src/renderer/store/modules/application.store.js @@ -1,34 +1,23 @@ 'use strict'; -import i18n from '@/i18n'; - export default { namespaced: true, strict: true, state: { app_name: 'Antares - SQL Client', - is_loading: false, - locale: 'it-IT' + is_loading: false }, getters: { isLoading: state => state.is_loading, - appName: state => state.app_name, - getLocale: state => state.locale + appName: state => state.app_name }, mutations: { SET_LOADING_STATUS (state, payload) { state.is_loading = payload; - }, - SET_LOCALE (state, locale) { - state.locale = locale; - i18n.locale = locale; } }, actions: { setLoadingStatus ({ commit }, payload) { commit('SET_LOADING_STATUS', payload); - }, - changeLocale ({ commit }, locale) { - commit('SET_LOCALE', locale); } } }; diff --git a/src/renderer/store/modules/settings.store.js b/src/renderer/store/modules/settings.store.js new file mode 100644 index 00000000..4e863889 --- /dev/null +++ b/src/renderer/store/modules/settings.store.js @@ -0,0 +1,24 @@ +'use strict'; +import i18n from '@/i18n'; + +export default { + namespaced: true, + strict: true, + state: { + locale: 'it-IT' + }, + getters: { + getLocale: state => state.locale + }, + mutations: { + SET_LOCALE (state, locale) { + state.locale = locale; + i18n.locale = locale; + } + }, + actions: { + changeLocale ({ commit }, locale) { + commit('SET_LOCALE', locale); + } + } +};