-
Notifications
You must be signed in to change notification settings - Fork 88
Closed
Labels
Description
I have the locale
reducer set :
import { localeReducer as locale } from 'react-localize-redux';
combineReducers({ locale, otherReducers});
The languages initialized:
const languageToUse = 'en';
const languages = ['en', 'fr'];
store.dispatch(initialize(languages));
const json = require('../static/texts/global.locale.json');
store.dispatch(addTranslation(json));
store.dispatch(setActiveLanguage(languageToUse));
And the function mapped to the props:
import { getTranslate, getActiveLanguage, setActiveLanguage } from 'react-localize-redux';
function mapStateToProps(state) {
return {
restOfState: state.restOfState,
translate: getTranslate(state.locale),
currentLanguage: getActiveLanguage(state.locale).code,
setActiveLanguage: setActiveLanguage,
};
}
export default mapStateToProps;
However calling this.props.setActiveLanguage('fr')
in a connected component does not change anything (logging this.props.currentLanguage
). Is this an issue or am I missing something?