diff --git a/src/components/recaptcha/ReCaptcha.js b/src/components/recaptcha/ReCaptcha.js index 90abd3902f..cc553e46f9 100644 --- a/src/components/recaptcha/ReCaptcha.js +++ b/src/components/recaptcha/ReCaptcha.js @@ -134,19 +134,19 @@ export default class ReCaptchaComponent extends Component { const componentData = row[this.component.key]; if (!componentData || !componentData.token) { - this.setCustomValidity('ReCAPTCHA: Token is not specified in submission'); + this.setCustomValidity(this.t('reCaptchaTokenNotSpecifiedError')); return Promise.resolve(false); } if (!componentData.success) { - this.setCustomValidity('ReCAPTCHA: Token validation error'); + this.setCustomValidity(this.t('reCaptchaTokenValidationError')); return Promise.resolve(false); } return this.hook('validateReCaptcha', componentData.token, () => Promise.resolve(true)) .then((success) => success) .catch((err) => { - this.setCustomValidity(err.message || err); + this.setCustomValidity(this.t(err.message || err)); return false; }); } diff --git a/src/translations/en.js b/src/translations/en.js index ed7e4848a8..aeda3b9e80 100644 --- a/src/translations/en.js +++ b/src/translations/en.js @@ -62,4 +62,6 @@ export default { previousButtonAriaLabel:'Previous button. Click to go back to the previous tab', nextButtonAriaLabel:'Next button. Click to go to the next tab', submitButtonAriaLabel:'Submit Form button. Click to submit the form', + reCaptchaTokenValidationError: 'ReCAPTCHA: Token validation error', + reCaptchaTokenNotSpecifiedError: 'ReCAPTCHA: Token is not specified in submission', };