diff --git a/source/components/pages/Header.js b/source/components/pages/Header.js
index c63632d21..cdad91d0f 100644
--- a/source/components/pages/Header.js
+++ b/source/components/pages/Header.js
@@ -31,7 +31,11 @@ export class Header extends Component {
onClick={() => screenfull.toggle()}
className={appMode ? 'absolute' : ''}
>
- {!appMode && Mode plein écran}
+ {!appMode && (
+
+ Mode plein écran
+
+ )}
(
@withRouter
@translate()
-@connect(
- state => ({}),
- dispatch => ({
- changeLanguage: (lang) => dispatch({ type: CHANGE_LANG, lang })
- })
-)
+@connect(null, dispatch => ({
+ changeLanguage: lang => dispatch({ type: CHANGE_LANG, lang })
+}))
export class Footer extends Component {
static contextTypes = {
- i18n: PropTypes.object.isRequired
- }
+ i18n: PropTypes.object.isRequired
+ }
+
+ getUnusedLanguage = () => (this.context.i18n.language === 'fr' ? 'en' : 'fr')
+
+ changeLanguage = () => {
+ let nextLanguage = this.getUnusedLanguage()
+ this.props.changeLanguage(nextLanguage)
+ this.context.i18n.changeLanguage(nextLanguage)
+ }
render() {
- let { i18n } = this.context
- let changeLanguage = lng => {
- this.props.changeLanguage(lng)
- i18n.changeLanguage(lng)
- }
let appMode = ['/simu', '/regle'].find(t =>
this.props.location.pathname.includes(t)
)
return (
)
}