Skip to content

Commit

Permalink
fix: locale change
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Apr 22, 2022
1 parent e60789f commit 6af0c33
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions scripts/devRunner.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/i18n/index.js
Original file line number Diff line number Diff line change
@@ -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'),
Expand Down
4 changes: 3 additions & 1 deletion src/renderer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
2 changes: 0 additions & 2 deletions src/renderer/store/index.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/store/modules/settings.store.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 5 additions & 0 deletions webpack.renderer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}"`
Expand Down

0 comments on commit 6af0c33

Please sign in to comment.