diff options
Diffstat (limited to 'app/client/system/system.reducer.js')
| -rw-r--r-- | app/client/system/system.reducer.js | 17 |
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 } |
