La langue par défaut est définie dans les reducers
parent
29b234cf4c
commit
5d857d2dfa
|
@ -40,4 +40,3 @@ export function changeThemeColour(colour) {
|
|||
}
|
||||
|
||||
export const EXPLAIN_VARIABLE = 'EXPLAIN_VARIABLE'
|
||||
export const CHANGE_LANG = 'CHANGE_LANG'
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue