Moving the translations too

This commit is contained in:
okbel
2018-05-02 14:08:29 -03:00
parent 780bd42ceb
commit 8dcaf8ea4c
7 changed files with 132 additions and 50 deletions
@@ -28,26 +28,26 @@ class ChangeEmailContentDialog extends React.Component {
×
</span>
<h1 className={styles.title}>
{t('talk-plugin-auth.change_email.confirm_email_change')}
{t('talk-plugin-local-auth.change_email.confirm_email_change')}
</h1>
<div className={styles.content}>
<p className={styles.description}>
{t('talk-plugin-auth.change_email.description')}
{t('talk-plugin-local-auth.change_email.description')}
</p>
<div className={styles.emailChange}>
<span className={styles.item}>
{t('talk-plugin-auth.change_email.old_email')}:{' '}
{t('talk-plugin-local-auth.change_email.old_email')}:{' '}
{this.props.emailAddress}
</span>
<span className={styles.item}>
{t('talk-plugin-auth.change_email.new_email')}:{' '}
{t('talk-plugin-local-auth.change_email.new_email')}:{' '}
{this.props.formData.newEmail}
</span>
</div>
<form>
<InputField
id="confirmPassword"
label={t('talk-plugin-auth.change_email.enter_password')}
label={t('talk-plugin-local-auth.change_email.enter_password')}
name="confirmPassword"
type="password"
onChange={this.props.onChange}
@@ -55,7 +55,9 @@ class ChangeEmailContentDialog extends React.Component {
hasError={
!this.props.formData.confirmPassword && this.state.showError
}
errorMsg={t('talk-plugin-auth.change_email.incorrect_password')}
errorMsg={t(
'talk-plugin-local-auth.change_email.incorrect_password'
)}
showError={this.state.showError}
columnDisplay
showSuccess={false}
@@ -63,13 +65,13 @@ class ChangeEmailContentDialog extends React.Component {
</form>
<div className={styles.bottomActions}>
<Button className={styles.cancel} onClick={this.props.cancel}>
{t('talk-plugin-auth.change_email.cancel')}
{t('talk-plugin-local-auth.change_email.cancel')}
</Button>
<Button
className={styles.confirmChanges}
onClick={this.confirmChanges}
>
{t('talk-plugin-auth.change_email.confirm_change')}
{t('talk-plugin-local-auth.change_email.confirm_change')}
</Button>
</div>
</div>
@@ -45,7 +45,9 @@ class ChangePassword extends React.Component {
const cond = this.state.formData[field] === this.state.formData[field2];
if (!cond) {
this.addError({
[field2]: t('talk-plugin-auth.change_password.passwords_dont_match'),
[field2]: t(
'talk-plugin-local-auth.change_password.passwords_dont_match'
),
});
} else {
this.removeError(field2);
@@ -56,7 +58,7 @@ class ChangePassword extends React.Component {
fieldValidation = (value, type, name) => {
if (!value.length) {
this.addError({
[name]: t('talk-plugin-auth.change_password.required_field'),
[name]: t('talk-plugin-local-auth.change_password.required_field'),
});
} else if (!validate[type](value)) {
this.addError({ [name]: errorMsj[type] });
@@ -113,7 +115,7 @@ class ChangePassword extends React.Component {
});
this.props.notify(
'success',
t('talk-plugin-auth.change_password.changed_password_msg')
t('talk-plugin-local-auth.change_password.changed_password_msg')
);
} catch (err) {
this.props.notify('error', getErrorMessages(err));
@@ -139,15 +141,19 @@ class ChangePassword extends React.Component {
return (
<section
className={cn('talk-plugin-auth--change-password', styles.container, {
[styles.editing]: editing,
})}
className={cn(
'talk-plugin-local-auth--change-password',
styles.container,
{
[styles.editing]: editing,
}
)}
>
<h3 className={styles.title}>
{t('talk-plugin-auth.change_password.change_password')}
{t('talk-plugin-local-auth.change_password.change_password')}
</h3>
{editing && (
<form className="talk-plugin-auth--change-password-form">
<form className="talk-plugin-local-auth--change-password-form">
<InputField
id="oldPassword"
label="Old Password"
@@ -161,7 +167,7 @@ class ChangePassword extends React.Component {
>
<span className={styles.detailBottomBox}>
<a className={styles.detailLink}>
{t('talk-plugin-auth.change_password.forgot_password')}
{t('talk-plugin-local-auth.change_password.forgot_password')}
</a>
</span>
</InputField>
@@ -197,16 +203,16 @@ class ChangePassword extends React.Component {
onClick={this.onSave}
disabled={this.isSubmitBlocked()}
>
{t('talk-plugin-auth.change_password.save')}
{t('talk-plugin-local-auth.change_password.save')}
</Button>
<a className={styles.cancelButton} onClick={this.cancel}>
{t('talk-plugin-auth.change_password.cancel')}
{t('talk-plugin-local-auth.change_password.cancel')}
</a>
</div>
) : (
<div className={styles.actions}>
<Button className={styles.button} onClick={this.enableEditing}>
{t('talk-plugin-auth.change_password.edit')}
{t('talk-plugin-local-auth.change_password.edit')}
</Button>
</div>
)}
@@ -25,7 +25,7 @@ class ChangeUsernameContentDialog extends React.Component {
if (!this.props.canUsernameBeUpdated) {
this.props.notify(
'error',
t('talk-plugin-auth.change_username.change_username_attempt')
t('talk-plugin-local-auth.change_username.change_username_attempt')
);
return;
}
@@ -44,19 +44,19 @@ class ChangeUsernameContentDialog extends React.Component {
×
</span>
<h1 className={styles.title}>
{t('talk-plugin-auth.change_username.confirm_username_change')}
{t('talk-plugin-local-auth.change_username.confirm_username_change')}
</h1>
<div className={styles.content}>
<p className={styles.description}>
{t('talk-plugin-auth.change_username.description')}
{t('talk-plugin-local-auth.change_username.description')}
</p>
<div className={styles.usernamesChange}>
<span className={styles.item}>
{t('talk-plugin-auth.change_username.old_username')}:{' '}
{t('talk-plugin-local-auth.change_username.old_username')}:{' '}
{this.props.username}
</span>
<span className={styles.item}>
{t('talk-plugin-auth.change_username.new_username')}:{' '}
{t('talk-plugin-local-auth.change_username.new_username')}:{' '}
{this.props.formData.newUsername}
</span>
</div>
@@ -70,7 +70,7 @@ class ChangeUsernameContentDialog extends React.Component {
defaultValue=""
hasError={this.formHasError() && this.state.showError}
errorMsg={t(
'talk-plugin-auth.change_username.username_does_not_match'
'talk-plugin-local-auth.change_username.username_does_not_match'
)}
showError={this.state.showError}
columnDisplay
@@ -78,19 +78,19 @@ class ChangeUsernameContentDialog extends React.Component {
validationType="username"
>
<span className={styles.bottomNote}>
{t('talk-plugin-auth.change_username.bottom_note')}
{t('talk-plugin-local-auth.change_username.bottom_note')}
</span>
</InputField>
</form>
<div className={styles.bottomActions}>
<Button className={styles.cancel} onClick={this.props.cancel}>
{t('talk-plugin-auth.change_username.cancel')}
{t('talk-plugin-local-auth.change_username.cancel')}
</Button>
<Button
className={styles.confirmChanges}
onClick={this.confirmChanges}
>
{t('talk-plugin-auth.change_username.confirm_changes')}
{t('talk-plugin-local-auth.change_username.confirm_changes')}
</Button>
</div>
</div>
@@ -26,7 +26,7 @@ class ChangeUsernameDialog extends React.Component {
if (!this.props.canUsernameBeUpdated) {
this.props.notify(
'error',
t('talk-plugin-auth.change_username.change_username_attempt')
t('talk-plugin-local-auth.change_username.change_username_attempt')
);
return;
}
@@ -42,25 +42,28 @@ class ChangeUsernameDialog extends React.Component {
return (
<Dialog
open={this.props.showDialog}
className={cn(styles.dialog, 'talk-plugin-auth--edit-profile-dialog')}
className={cn(
styles.dialog,
'talk-plugin-local-auth--edit-profile-dialog'
)}
>
<span className={styles.close} onClick={this.props.closeDialog}>
×
</span>
<h1 className={styles.title}>
{t('talk-plugin-auth.change_username.confirm_username_change')}
{t('talk-plugin-local-auth.change_username.confirm_username_change')}
</h1>
<div className={styles.content}>
<p className={styles.description}>
{t('talk-plugin-auth.change_username.description')}
{t('talk-plugin-local-auth.change_username.description')}
</p>
<div className={styles.usernamesChange}>
<span className={styles.item}>
{t('talk-plugin-auth.change_username.old_username')}:{' '}
{t('talk-plugin-local-auth.change_username.old_username')}:{' '}
{this.props.username}
</span>
<span className={styles.item}>
{t('talk-plugin-auth.change_username.new_username')}:{' '}
{t('talk-plugin-local-auth.change_username.new_username')}:{' '}
{this.props.formData.newUsername}
</span>
</div>
@@ -74,7 +77,7 @@ class ChangeUsernameDialog extends React.Component {
defaultValue=""
hasError={this.formHasError() && this.state.showError}
errorMsg={t(
'talk-plugin-auth.change_username.username_does_not_match'
'talk-plugin-local-auth.change_username.username_does_not_match'
)}
showError={this.state.showError}
columnDisplay
@@ -82,19 +85,19 @@ class ChangeUsernameDialog extends React.Component {
validationType="username"
>
<span className={styles.bottomNote}>
{t('talk-plugin-auth.change_username.bottom_note')}
{t('talk-plugin-local-auth.change_username.bottom_note')}
</span>
</InputField>
</form>
<div className={styles.bottomActions}>
<Button className={styles.cancel}>
{t('talk-plugin-auth.change_username.cancel')}
{t('talk-plugin-local-auth.change_username.cancel')}
</Button>
<Button
className={styles.confirmChanges}
onClick={this.confirmChanges}
>
{t('talk-plugin-auth.change_username.confirm_changes')}
{t('talk-plugin-local-auth.change_username.confirm_changes')}
</Button>
</div>
</div>
@@ -54,7 +54,10 @@ class ConfirmChangesDialog extends React.Component {
return (
<Dialog
open={this.props.showDialog}
className={cn(styles.dialog, 'talk-plugin-auth--edit-profile-dialog')}
className={cn(
styles.dialog,
'talk-plugin-local-auth--edit-profile-dialog'
)}
>
{this.renderSteps()}
</Dialog>
@@ -72,7 +72,7 @@ class Profile extends React.Component {
fieldValidation = (value, type, name) => {
if (!value.length) {
this.addError({
[name]: t('talk-plugin-auth.change_password.required_field'),
[name]: t('talk-plugin-local-auth.change_password.required_field'),
});
} else if (!validate[type](value)) {
this.addError({ [name]: errorMsj[type] });
@@ -127,7 +127,7 @@ class Profile extends React.Component {
await changeUsername(this.props.root.me.id, newUsername);
this.props.notify(
'success',
t('talk-plugin-auth.change_username.changed_username_success_msg')
t('talk-plugin-local-auth.change_username.changed_username_success_msg')
);
} catch (err) {
this.props.notify('error', getErrorMessages(err));
@@ -144,7 +144,7 @@ class Profile extends React.Component {
});
this.props.notify(
'success',
t('talk-plugin-auth.change_email.change_email_msg')
t('talk-plugin-local-auth.change_email.change_email_msg')
);
} catch (err) {
this.props.notify('error', getErrorMessages(err));
@@ -167,9 +167,13 @@ class Profile extends React.Component {
return (
<section
className={cn('talk-plugin-auth--edit-profile', styles.container, {
[styles.editing]: editing,
})}
className={cn(
'talk-plugin-local-auth--edit-profile',
styles.container,
{
[styles.editing]: editing,
}
)}
>
<ConfirmChangesDialog
showDialog={showDialog}
@@ -207,7 +211,9 @@ class Profile extends React.Component {
columnDisplay
>
<span className={styles.bottomText}>
{t('talk-plugin-auth.change_username.change_username_note')}
{t(
'talk-plugin-local-auth.change_username.change_username_note'
)}
</span>
</InputField>
<InputField
@@ -237,10 +243,10 @@ class Profile extends React.Component {
onClick={this.onSave}
disabled={!this.isSaveEnabled()}
>
{t('talk-plugin-auth.change_username.save')}
{t('talk-plugin-local-auth.change_username.save')}
</Button>
<a className={styles.cancelButton} onClick={this.cancel}>
{t('talk-plugin-auth.change_username.cancel')}
{t('talk-plugin-local-auth.change_username.cancel')}
</a>
</div>
) : (
@@ -250,7 +256,7 @@ class Profile extends React.Component {
icon="settings"
onClick={this.enableEditing}
>
{t('talk-plugin-auth.change_username.edit_profile')}
{t('talk-plugin-local-auth.change_username.edit_profile')}
</Button>
</div>
)}