fix: locale change

This commit is contained in:
Fabio Di Stasio 2022-04-22 17:45:12 +02:00
parent e60789f320
commit 6af0c33461
6 changed files with 13 additions and 7 deletions

View File

@ -1,5 +1,6 @@
process.env.NODE_ENV = 'development';
// process.env.ELECTRON_ENABLE_LOGGING = true
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = false;
const chalk = require('chalk');
const electron = require('electron');

View File

@ -1,7 +1,7 @@
import { createI18n } from 'vue-i18n/dist/vue-i18n.esm-bundler.js';// NOTES: temporary fix to compile error
import { createI18n } from 'vue-i18n/dist/vue-i18n.esm-bundler';
const i18n = locale => createI18n({
locale,
const i18n = createI18n({
fallbackLocale: 'en-US',
messages: {
'en-US': require('./en-US'),
'it-IT': require('./it-IT'),

View File

@ -9,7 +9,9 @@ import App from '@/App.vue';
import { store } from '@/store';
import i18n from '@/i18n';
i18n.global.locale = store.state.settings.locale;
const app = createApp(App);
app.use(store);
app.use(i18n(store.state.settings.locale));
app.use(i18n);
app.mount('#app');

View File

@ -1,7 +1,5 @@
'use strict';
import { createStore } from 'vuex/dist/vuex.esm-bundler';
// import Vue from 'vue';
// import Vuex from 'vuex';
import application from './modules/application.store';
import settings from './modules/settings.store';

View File

@ -40,7 +40,7 @@ export default {
mutations: {
SET_LOCALE (state, locale) {
state.locale = locale;
i18n.locale = locale;
i18n.global.locale = locale;
persistentStore.set('locale', state.locale);
},
SET_DATA_TAB_LIMIT (state, limit) {

View File

@ -69,6 +69,11 @@ const config = {
}),
new VueLoaderPlugin(),
new webpack.DefinePlugin({
__VUE_OPTIONS_API__: true,
__VUE_PROD_DEVTOOLS__: isDevMode,
__VUE_I18N_LEGACY_API__: true,
__VUE_I18N_FULL_INSTALL__: true,
__INTLIFY_PROD_DEVTOOLS__: isDevMode,
'process.env': {
PACKAGE_VERSION: `"${version}"`,
APP_CONTRIBUTORS: `"${parsedContributors}"`