diff --git a/client/components/Nav.jsx b/client/components/Nav.jsx index 16617112..4f315bb3 100644 --- a/client/components/Nav.jsx +++ b/client/components/Nav.jsx @@ -608,13 +608,13 @@ class Nav extends React.PureComponent { diff --git a/client/modules/User/components/LoginForm.jsx b/client/modules/User/components/LoginForm.jsx index 974f50ba..c99df6d6 100644 --- a/client/modules/User/components/LoginForm.jsx +++ b/client/modules/User/components/LoginForm.jsx @@ -1,6 +1,7 @@ import PropTypes from 'prop-types'; import React from 'react'; - +import { withTranslation } from 'react-i18next'; +import i18n from 'i18next'; import Button from '../../../common/Button'; import { domOnlyProps } from '../../../utils/reduxFormUtils'; @@ -18,12 +19,10 @@ function LoginForm(props) { onSubmit={handleSubmit(props.validateAndLoginUser.bind(this, props.previousPath))} >

- +

- + {password.error} )}

- ); @@ -65,6 +64,7 @@ LoginForm.propTypes = { pristine: PropTypes.bool, invalid: PropTypes.bool, previousPath: PropTypes.string.isRequired, + t: PropTypes.func.isRequired }; LoginForm.defaultProps = { @@ -73,4 +73,4 @@ LoginForm.defaultProps = { invalid: false, }; -export default LoginForm; +export default withTranslation()(LoginForm); diff --git a/client/modules/User/components/SocialAuthButton.jsx b/client/modules/User/components/SocialAuthButton.jsx index afcb605d..62bf4097 100644 --- a/client/modules/User/components/SocialAuthButton.jsx +++ b/client/modules/User/components/SocialAuthButton.jsx @@ -1,6 +1,8 @@ import PropTypes from 'prop-types'; import React from 'react'; import styled from 'styled-components'; +import i18n from 'i18next'; +import { withTranslation } from 'react-i18next'; import { remSize } from '../../../theme'; @@ -12,11 +14,6 @@ const authUrls = { google: '/auth/google' }; -const labels = { - github: 'Login with GitHub', - google: 'Login with Google' -}; - const icons = { github: GithubIcon, google: GoogleIcon @@ -31,11 +28,15 @@ const StyledButton = styled(Button)` width: ${remSize(300)}; `; -function SocialAuthButton({ service }) { +function SocialAuthButton({ service, t }) { const ServiceIcon = icons[service]; + const labels = { + github: t('SocialAuthButton.Github'), + google: t('SocialAuthButton.Google') + }; return ( } + iconBefore={} href={authUrls[service]} > {labels[service]} @@ -46,7 +47,10 @@ function SocialAuthButton({ service }) { SocialAuthButton.services = services; SocialAuthButton.propTypes = { - service: PropTypes.oneOf(['github', 'google']).isRequired + service: PropTypes.oneOf(['github', 'google']).isRequired, + t: PropTypes.func.isRequired }; -export default SocialAuthButton; +const SocialAuthButtonPublic = withTranslation()(SocialAuthButton); +SocialAuthButtonPublic.services = services; +export default SocialAuthButtonPublic; diff --git a/client/modules/User/pages/LoginView.jsx b/client/modules/User/pages/LoginView.jsx index 84e3c4c9..20b48b17 100644 --- a/client/modules/User/pages/LoginView.jsx +++ b/client/modules/User/pages/LoginView.jsx @@ -3,6 +3,8 @@ import React from 'react'; import { reduxForm } from 'redux-form'; import { Link, browserHistory } from 'react-router'; import { Helmet } from 'react-helmet'; +import { withTranslation } from 'react-i18next'; +import i18n from 'i18next'; import { validateAndLoginUser } from '../actions'; import LoginForm from '../components/LoginForm'; import { validateLogin } from '../../../utils/reduxFormUtils'; @@ -34,23 +36,23 @@ class LoginView extends React.Component {