summaryrefslogtreecommitdiff
path: root/app/client/system/system.reducer.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2019-03-26 14:43:48 +0100
committerJules Laplace <julescarbon@gmail.com>2019-03-26 14:43:48 +0100
commit8c1a9a05599c1e1b45992ab14fc391f89f34e63d (patch)
tree5f8e564efa2663d4ecaba631b10d441900ebf5de /app/client/system/system.reducer.js
parentd660b951977917c5047da0db21c5c6b3937b764d (diff)
adding i18n framework
Diffstat (limited to 'app/client/system/system.reducer.js')
-rw-r--r--app/client/system/system.reducer.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/client/system/system.reducer.js b/app/client/system/system.reducer.js
index 5f9e4ac..f232da3 100644
--- a/app/client/system/system.reducer.js
+++ b/app/client/system/system.reducer.js
@@ -1,7 +1,11 @@
import types from '../types'
import moment from 'moment/min/moment.min'
+import * as i18n from '../i18n'
+
let FileSaver = require('file-saver')
+const initialLanguage = localStorage.getItem('cortex.i18n.language') || process.env.I18N_LANGUAGE || 'en'
+
const systemInitialState = {
loading: false,
error: null,
@@ -14,6 +18,10 @@ const systemInitialState = {
production: process.env.NODE_ENV === 'production',
development: process.env.NODE_ENV !== 'production',
},
+ i18n: {
+ language: initialLanguage,
+ strings: i18n.strings(initialLanguage),
+ },
app: {
tool: localStorage.getItem('system.last_tool') || 'pix2pixhd',
},
@@ -246,6 +254,15 @@ const systemReducer = (state = systemInitialState, action) => {
last_message: action.data.data,
stderr: state.stderr + action.data.data,
}
+ case types.system.change_language:
+ return {
+ ...state,
+ i18n: {
+ language: action.language,
+ strings: i18n.strings(action.language),
+ }
+ }
+
default:
return state
}