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

@ -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);