Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Password Error message Translation on Language change #4880

Merged
merged 7 commits into from
Aug 27, 2021
6 changes: 3 additions & 3 deletions src/pages/signin/LoginForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class LoginForm extends React.Component {
*/
validateAndSubmitForm() {
if (!this.state.login.trim()) {
this.setState({formError: this.props.translate('loginForm.pleaseEnterEmailOrPhoneNumber')});
this.setState({formError: 'loginForm.pleaseEnterEmailOrPhoneNumber'});
return;
}

Expand Down Expand Up @@ -91,11 +91,11 @@ class LoginForm extends React.Component {
</View>
{this.state.formError && (
<Text style={[styles.formError]}>
{this.state.formError}
{this.props.translate(this.state.formError)}
</Text>
)}

{!_.isEmpty(this.props.account.error) && (
{!this.state.formError && !_.isEmpty(this.props.account.error) && (
<Text style={[styles.formError]}>
{this.props.account.error}
</Text>
Expand Down
6 changes: 3 additions & 3 deletions src/pages/signin/PasswordForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class PasswordForm extends React.Component {
if (!this.state.password.trim()
|| (this.props.account.requiresTwoFactorAuth && !this.state.twoFactorAuthCode.trim())
) {
this.setState({formError: this.props.translate('passwordForm.pleaseFillOutAllFields')});
this.setState({formError: 'passwordForm.pleaseFillOutAllFields'});
return;
}

Expand Down Expand Up @@ -111,15 +111,15 @@ class PasswordForm extends React.Component {
</View>
)}

{this.props.account && !_.isEmpty(this.props.account.error) && (
{!this.state.formError && this.props.account && !_.isEmpty(this.props.account.error) && (
<Text style={[styles.formError]}>
{this.props.account.error}
</Text>
)}

{this.state.formError && (
<Text style={[styles.formError]}>
{this.state.formError}
{this.props.translate(this.state.formError)}
</Text>
)}
<View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const TermsWithLicenses = ({translate}) => (
styles.justifyContentCenter,
]}
>
<View style={[styles.dFlex, styles.flexRow, styles.alignItemsCenter]}>
<View style={[styles.dFlex, styles.flexRow, styles.flexWrap, styles.alignItemsCenter]}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job finding this one!

<Text style={[styles.textAlignCenter, styles.loginTermsText]}>
{translate('termsOfUse.phrase1')}
</Text>
Expand Down