From ff40de36ca6711127182959fcfbf06ab0c0a7d5f Mon Sep 17 00:00:00 2001 From: ov Date: Thu, 13 Aug 2020 11:12:02 +0100 Subject: [PATCH 1/2] Spanish Translation: Reset password Form and View (#1545) * Reset Password Form using login view translation keys * reduxFormUtils.js with i18 functionality to translate validations --- .../User/components/ResetPasswordForm.jsx | 15 ++++--- .../modules/User/pages/ResetPasswordView.jsx | 19 ++++---- client/utils/reduxFormUtils.js | 31 ++++++------- translations/locales/en-US/translations.json | 32 ++++++++++++-- translations/locales/es-419/translations.json | 44 ++++++++++++++----- 5 files changed, 96 insertions(+), 45 deletions(-) diff --git a/client/modules/User/components/ResetPasswordForm.jsx b/client/modules/User/components/ResetPasswordForm.jsx index df96bd79..87155f43 100644 --- a/client/modules/User/components/ResetPasswordForm.jsx +++ b/client/modules/User/components/ResetPasswordForm.jsx @@ -1,20 +1,20 @@ import PropTypes from 'prop-types'; import React from 'react'; - +import { withTranslation } from 'react-i18next'; import { domOnlyProps } from '../../../utils/reduxFormUtils'; import Button from '../../../common/Button'; function ResetPasswordForm(props) { const { - fields: { email }, handleSubmit, submitting, invalid, pristine + fields: { email }, handleSubmit, submitting, invalid, pristine, t } = props; return (

- + Send Password Reset Email + >{t('ResetPasswordForm.Submit')}

); @@ -41,7 +41,8 @@ ResetPasswordForm.propTypes = { pristine: PropTypes.bool, user: PropTypes.shape({ resetPasswordInitiate: PropTypes.bool - }).isRequired + }).isRequired, + t: PropTypes.func.isRequired }; ResetPasswordForm.defaultProps = { @@ -50,4 +51,4 @@ ResetPasswordForm.defaultProps = { invalid: false }; -export default ResetPasswordForm; +export default withTranslation()(ResetPasswordForm); diff --git a/client/modules/User/pages/ResetPasswordView.jsx b/client/modules/User/pages/ResetPasswordView.jsx index 8ff7dac1..46d0b517 100644 --- a/client/modules/User/pages/ResetPasswordView.jsx +++ b/client/modules/User/pages/ResetPasswordView.jsx @@ -6,6 +6,7 @@ import classNames from 'classnames'; import { bindActionCreators } from 'redux'; import { reduxForm } from 'redux-form'; import { Helmet } from 'react-helmet'; +import { withTranslation } from 'react-i18next'; import * as UserActions from '../actions'; import ResetPasswordForm from '../components/ResetPasswordForm'; import { validateResetPassword } from '../../../utils/reduxFormUtils'; @@ -23,19 +24,18 @@ function ResetPasswordView(props) {