More i18n work

This commit is contained in:
vjrj 2017-11-28 18:24:50 +01:00
parent 3ef6f3c80b
commit 2ad4972115
16 changed files with 286 additions and 90 deletions

View file

@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import { Meteor } from 'meteor/meteor';
import { Bert } from 'meteor/themeteorchef:bert';
import Icon from '../Icon/Icon';
import { translate, Trans } from 'react-i18next';
import './OAuthLoginButton.scss';
@ -31,9 +32,9 @@ const handleLogin = (service, callback) => {
};
const serviceLabel = {
facebook: <span><Icon icon="facebook-official" /> Log In with Facebook</span>,
github: <span><Icon icon="github" /> Log In with GitHub</span>,
google: <span><Icon icon="google" /> Log In with Google</span>,
facebook: <span><Icon icon="facebook-official" /> <Trans parent="span">Log In with Facebook</Trans></span>,
github: <span><Icon icon="github" /> <Trans parent="span">Log In with GitHub</Trans></span>,
google: <span><Icon icon="google" /> <Trans parent="span">Iniciar sesión con Google</Trans></span>,
};
const OAuthLoginButton = ({ service, callback }) => (
@ -57,4 +58,4 @@ OAuthLoginButton.propTypes = {
callback: PropTypes.func,
};
export default OAuthLoginButton;
export default translate([], { wait: true })(OAuthLoginButton);

View file

@ -13,7 +13,7 @@
background: #fff;
padding: 0 10px;
position: absolute;
bottom: -19px;
bottom: -27px;
left: 50%;
}
}

View file

@ -0,0 +1,34 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Grid, Alert, Button } from 'react-bootstrap';
import { t, Trans, translate, Interpolate } from 'react-i18next';
const handleResendVerificationEmail = (emailAddress, t) => {
Meteor.call('users.sendVerificationEmail', (error) => {
if (error) {
Bert.alert(error.reason, 'danger');
} else {
Bert.alert(t("checkVerificationEmail", {email: emailAddress}), 'success');
}
});
};
const ReSendEmail = props => (
<div>
{props.userId && !props.emailVerified ? <Alert className="verify-email text-center"><p><Interpolate i18nKey="verifyEmail" email={props.emailAddress}></Interpolate> <Button bsStyle="link" onClick={() => handleResendVerificationEmail(props.emailAddress, props.t)} href="#"><Trans parent="span">Reenviar email de verificación</Trans></Button></p></Alert> : ''}
</div>
);
ReSendEmail.defaultProps = {
userId: '',
emailAddress: '',
};
ReSendEmail.propTypes = {
loading: PropTypes.bool.isRequired,
userId: PropTypes.string,
emailAddress: PropTypes.string,
emailVerified: PropTypes.bool.isRequired,
};
export default translate([], { wait: true })(ReSendEmail);