web: People: Changed language state mapping

This commit is contained in:
Alexey Safronov 2019-09-29 15:29:19 +03:00
parent e0578eb7d4
commit 1e7d1610fc
2 changed files with 8 additions and 8 deletions

View File

@ -73,10 +73,9 @@ class PureProfile extends React.Component {
const ProfileContainer = withTranslation()(PureProfile); const ProfileContainer = withTranslation()(PureProfile);
const Profile = (props) => { const Profile = (props) => {
const { profile } = props; const { language } = props;
const lng = (profile && profile.cultureName) || "en";
i18n.changeLanguage(lng); i18n.changeLanguage(language);
return <I18nextProvider i18n={i18n}><ProfileContainer {...props} /></I18nextProvider> return <I18nextProvider i18n={i18n}><ProfileContainer {...props} /></I18nextProvider>
}; };
@ -91,7 +90,8 @@ Profile.propTypes = {
function mapStateToProps(state) { function mapStateToProps(state) {
return { return {
profile: state.profile.targetUser profile: state.profile.targetUser,
language: state.auth.user.cultureName || state.auth.settings.culture,
}; };
} }

View File

@ -33,11 +33,10 @@ class ProfileAction extends React.Component {
console.log("ProfileAction render") console.log("ProfileAction render")
let loaded = false; let loaded = false;
const { profile, match } = this.props; const { profile, match, language } = this.props;
const { userId, type } = match.params; const { userId, type } = match.params;
const lng = (profile && profile.cultureName) || "en"; i18n.changeLanguage(language);
i18n.changeLanguage(lng);
if (type) { if (type) {
loaded = true; loaded = true;
@ -74,7 +73,8 @@ ProfileAction.propTypes = {
function mapStateToProps(state) { function mapStateToProps(state) {
return { return {
profile: state.profile.targetUser profile: state.profile.targetUser,
language: state.auth.user.cultureName || state.auth.settings.culture,
}; };
} }