diff --git a/source/actions.js b/source/actions.js index 2da0f2def..314d7d7cb 100644 --- a/source/actions.js +++ b/source/actions.js @@ -40,4 +40,3 @@ export function changeThemeColour(colour) { } export const EXPLAIN_VARIABLE = 'EXPLAIN_VARIABLE' -export const CHANGE_LANG = 'CHANGE_LANG' diff --git a/source/components/pages/Header.js b/source/components/pages/Header.js index 010bad0ad..16aa10996 100644 --- a/source/components/pages/Header.js +++ b/source/components/pages/Header.js @@ -6,7 +6,6 @@ import { Link } from 'react-router-dom' import screenfull from 'screenfull' import { connect } from 'react-redux' import { withRouter } from 'react-router' -import { CHANGE_LANG } from '../../actions' @withRouter @connect(state => ({ @@ -93,7 +92,7 @@ let Links = ({ toggle }) => ( @withRouter @translate() @connect(null, dispatch => ({ - changeLanguage: lang => dispatch({ type: CHANGE_LANG, lang }) + changeLanguage: lang => dispatch({ type: 'SWITCH_LANG', lang }) })) export class LangSwitcher extends Component { static contextTypes = { diff --git a/source/entry.js b/source/entry.js index a90abcb5d..7ce49f3a9 100644 --- a/source/entry.js +++ b/source/entry.js @@ -1,7 +1,6 @@ /* global process: false */ import ReactPiwik from 'Components/Tracker' -import { rules, rulesFr } from 'Engine/rules' import React from 'react' import { render } from 'react-dom' import { AppContainer } from 'react-hot-loader' @@ -9,7 +8,6 @@ import { Provider } from 'react-redux' import { applyMiddleware, compose, createStore } from 'redux' import computeThemeColours from './components/themeColours' import Layout from './containers/Layout' -import lang from './i18n' import trackDomainActions from './middlewares/trackDomainActions' import reducers from './reducers/reducers' import { @@ -19,7 +17,7 @@ import { import { getIframeOption, getUrl } from './utils' let tracker = { - push: console.log, + push: console.log, // eslint-disable-line no-console connectToHistory: history => history } if (process.env.NODE_ENV === 'production') { @@ -49,9 +47,6 @@ let initialStore = { const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose let enhancer = composeEnhancers(applyMiddleware(trackDomainActions(tracker))) -// let initialRules = lang == 'en' ? rules : rulesFr -//TODO reintroduce initial language -// let store = createStore(reducers, initialStore, enhancer) let anchor = document.querySelector('#js') persistSimulation(store) diff --git a/source/i18n.js b/source/i18n.js index d9f9907d5..92ca9c3bf 100644 --- a/source/i18n.js +++ b/source/i18n.js @@ -23,7 +23,7 @@ i18next.init( } }, (err, t) => { - console.log('Error from i18n load', err, t) + console.log('Error from i18n load', err, t) //eslint-disable-line no-console } ) diff --git a/source/reducers/reducers.js b/source/reducers/reducers.js index 609e3861a..416ede9ea 100644 --- a/source/reducers/reducers.js +++ b/source/reducers/reducers.js @@ -5,6 +5,7 @@ import reduceReducers from 'reduce-reducers' import { combineReducers } from 'redux' import { reducer as formReducer } from 'redux-form' import storageReducer from '../storage/reducer' +import defaultLang from '../i18n' function themeColours(state = computeThemeColours(), { type, colour }) { if (type == 'CHANGE_THEME_COLOUR') return computeThemeColours(colour) @@ -50,7 +51,7 @@ function activeTargetInput(state = null, { type, name }) { } } -function lang(state = null, { type, lang }) { +function lang(state = defaultLang, { type, lang }) { switch (type) { case 'SWITCH_LANG': return lang