Skip to content

Refactor: let reCAPTCHA error messages use translation

What does this MR do and why?

Replace the hardcoded error messages with translation methods. #354071 (closed)

The code logic is simple that the reCAPTCHA error messages will be placed in the translation method _(ERROR_MESSAGE) to make sure the messages can be overwritten.

Please see the sample code below:

Before

expect(flash[:alert]).to include 'There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.'

After

expect(flash[:alert]).to include _('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.')

Screenshots or screen recordings

No changes on GitLab UI.

Here the error message we are going to implement in Jihu GitLab. recaptcha_error_message

How to set up and validate locally

  1. Visit the snippets page like https://gitlab.com/gitlab-org/gitlab/-/snippets
  2. Fill the title and content with 12321
  3. Click on submit
  4. The expectation is that the error message should NOT be changed on GitLab.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by ARCHIVED - Martin Tan

Merge request reports

Loading