Skip to content

Commit 1eddeef

Browse files
oruburosandrewn
andauthored
Signup form: Spanish Translation (#1550)
* SignupForms and view Co-authored-by: Andrew Nicolaou <me@andrewnicolaou.co.uk>
1 parent 3333dd4 commit 1eddeef

File tree

4 files changed

+59
-19
lines changed

4 files changed

+59
-19
lines changed

client/modules/User/components/SignupForm.jsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import PropTypes from 'prop-types';
22
import React from 'react';
3+
import { withTranslation } from 'react-i18next';
34

45
import { domOnlyProps } from '../../../utils/reduxFormUtils';
56
import Button from '../../../common/Button';
@@ -13,44 +14,44 @@ function SignupForm(props) {
1314
return (
1415
<form className="form" onSubmit={handleSubmit(props.signUpUser.bind(this, props.previousPath))}>
1516
<p className="form__field">
16-
<label htmlFor="username" className="form__label">User Name</label>
17+
<label htmlFor="username" className="form__label">{props.t('SignupForm.Title')}</label>
1718
<input
1819
className="form__input"
19-
aria-label="username"
20+
aria-label={props.t('SignupForm.TitleARIA')}
2021
type="text"
2122
id="username"
2223
{...domOnlyProps(username)}
2324
/>
2425
{username.touched && username.error && <span className="form-error">{username.error}</span>}
2526
</p>
2627
<p className="form__field">
27-
<label htmlFor="email" className="form__label">Email</label>
28+
<label htmlFor="email" className="form__label">{props.t('SignupForm.Email')}</label>
2829
<input
2930
className="form__input"
30-
aria-label="email"
31+
aria-label={props.t('SignupForm.EmailARIA')}
3132
type="text"
3233
id="email"
3334
{...domOnlyProps(email)}
3435
/>
3536
{email.touched && email.error && <span className="form-error">{email.error}</span>}
3637
</p>
3738
<p className="form__field">
38-
<label htmlFor="password" className="form__label">Password</label>
39+
<label htmlFor="password" className="form__label">{props.t('SignupForm.Password')}</label>
3940
<input
4041
className="form__input"
41-
aria-label="password"
42+
aria-label={props.t('SignupForm.PasswordARIA')}
4243
type="password"
4344
id="password"
4445
{...domOnlyProps(password)}
4546
/>
4647
{password.touched && password.error && <span className="form-error">{password.error}</span>}
4748
</p>
4849
<p className="form__field">
49-
<label htmlFor="confirm password" className="form__label">Confirm Password</label>
50+
<label htmlFor="confirm password" className="form__label">{props.t('SignupForm.ConfirmPassword')}</label>
5051
<input
5152
className="form__input"
5253
type="password"
53-
aria-label="confirm password"
54+
aria-label={props.t('SignupForm.ConfirmPasswordARIA')}
5455
id="confirm password"
5556
{...domOnlyProps(confirmPassword)}
5657
/>
@@ -63,7 +64,7 @@ function SignupForm(props) {
6364
<Button
6465
type="submit"
6566
disabled={submitting || invalid || pristine}
66-
>Sign Up
67+
>{props.t('SignupForm.SubmitSignup')}
6768
</Button>
6869
</form>
6970
);
@@ -81,7 +82,8 @@ SignupForm.propTypes = {
8182
submitting: PropTypes.bool,
8283
invalid: PropTypes.bool,
8384
pristine: PropTypes.bool,
84-
previousPath: PropTypes.string.isRequired
85+
previousPath: PropTypes.string.isRequired,
86+
t: PropTypes.func.isRequired
8587
};
8688

8789
SignupForm.defaultProps = {
@@ -90,4 +92,4 @@ SignupForm.defaultProps = {
9092
invalid: false
9193
};
9294

93-
export default SignupForm;
95+
export default withTranslation()(SignupForm);

client/modules/User/pages/SignupView.jsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { bindActionCreators } from 'redux';
44
import { Link, browserHistory } from 'react-router';
55
import { Helmet } from 'react-helmet';
66
import { reduxForm } from 'redux-form';
7+
import { withTranslation } from 'react-i18next';
78
import * as UserActions from '../actions';
89
import SignupForm from '../components/SignupForm';
910
import apiClient from '../../../utils/apiClient';
@@ -26,19 +27,19 @@ class SignupView extends React.Component {
2627
<Nav layout="dashboard" />
2728
<main className="form-container">
2829
<Helmet>
29-
<title>p5.js Web Editor | Signup</title>
30+
<title>{this.props.t('SignupView.Title')}</title>
3031
</Helmet>
3132
<div className="form-container__content">
32-
<h2 className="form-container__title">Sign Up</h2>
33+
<h2 className="form-container__title">{this.props.t('SignupView.Description')}</h2>
3334
<SignupForm {...this.props} />
34-
<h2 className="form-container__divider">Or</h2>
35+
<h2 className="form-container__divider">{this.props.t('SignupView.Or')}</h2>
3536
<div className="form-container__stack">
3637
<SocialAuthButton service={SocialAuthButton.services.github} />
3738
<SocialAuthButton service={SocialAuthButton.services.google} />
3839
</div>
3940
<p className="form__navigation-options">
40-
Already have an account?&nbsp;
41-
<Link className="form__login-button" to="/login">Log In</Link>
41+
{this.props.t('SignupView.AlreadyHave')}
42+
<Link className="form__login-button" to="/login">{this.props.t('SignupView.Login')}</Link>
4243
</p>
4344
</div>
4445
</main>
@@ -108,7 +109,8 @@ SignupView.propTypes = {
108109
previousPath: PropTypes.string.isRequired,
109110
user: PropTypes.shape({
110111
authenticated: PropTypes.bool
111-
})
112+
}),
113+
t: PropTypes.func.isRequired
112114
};
113115

114116
SignupView.defaultProps = {
@@ -117,11 +119,11 @@ SignupView.defaultProps = {
117119
}
118120
};
119121

120-
export default reduxForm({
122+
export default withTranslation()(reduxForm({
121123
form: 'signup',
122124
fields: ['username', 'email', 'password', 'confirmPassword'],
123125
onSubmitFail,
124126
validate: validateSignup,
125127
asyncValidate,
126128
asyncBlurFields: ['username', 'email']
127-
}, mapStateToProps, mapDispatchToProps)(SignupView);
129+
}, mapStateToProps, mapDispatchToProps)(SignupView));

translations/locales/en-US/translations.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,5 +289,23 @@
289289
"ConfirmPassword": "Confirm Password",
290290
"ConfirmPasswordARIA": "Confirm Password",
291291
"SubmitSetNewPassword": "Set New Password"
292+
},
293+
"SignupForm": {
294+
"Title": "User Name",
295+
"TitleARIA": "username",
296+
"Email": "Email",
297+
"EmailARIA": "email",
298+
"Password": "Password",
299+
"PasswordARIA": "password",
300+
"ConfirmPassword": "Confirm Password",
301+
"ConfirmPasswordARIA": "Confirm password",
302+
"SubmitSignup": "Sign Up"
303+
},
304+
"SignupView": {
305+
"Title": "p5.js Web Editor | Signup",
306+
"Description": "Sign Up",
307+
"Or": "Or",
308+
"AlreadyHave": "Already have an account?",
309+
"Login": "Log In"
292310
}
293311
}

translations/locales/es-419/translations.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,5 +289,23 @@
289289
"ConfirmPassword": "Confirmar Contraseña",
290290
"ConfirmPasswordARIA": "Confirmar contraseña",
291291
"SubmitSetNewPassword": "Crear Nueva Contraseña"
292+
},
293+
"SignupForm": {
294+
"Title": "Identificación",
295+
"TitleARIA": "Identificación",
296+
"Email": "Correo electrónico",
297+
"EmailARIA": "correo electrónico",
298+
"Password": "Contraseña",
299+
"PasswordARIA": "contraseña",
300+
"ConfirmPassword": "Confirma tu contraseña",
301+
"ConfirmPasswordARIA": "Confirma tu contraseña",
302+
"SubmitSignup": "Registráte"
303+
},
304+
"SignupView": {
305+
"Title": " Editor Web p5.js | Registráte",
306+
"Description": "Registráte",
307+
"Or": "o",
308+
"AlreadyHave": "¿Ya tienes cuenta? ",
309+
"Login": "Ingresa"
292310
}
293311
}

0 commit comments

Comments
 (0)