Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support overriding RECAPTCHA_ERROR_CODES #593

Closed
PanderMusubi opened this issue Jan 8, 2024 · 1 comment
Closed

Support overriding RECAPTCHA_ERROR_CODES #593

PanderMusubi opened this issue Jan 8, 2024 · 1 comment

Comments

@PanderMusubi
Copy link

PanderMusubi commented Jan 8, 2024

The recaptcha error codes are in English, see https://github.com/wtforms/flask-wtf/blob/main/src/flask_wtf/recaptcha/validators.py#L10 and I would to overrride them with my (Dutch) translation.

    app.config['RECAPTCHA_ERROR_CODES'] = {
        'missing-input-secret': 'De geheime parameter ontbreekt.',
        'invalid-input-secret': 'De geheime parameter is ongeldig of misvormd.',
        'missing-input-response': 'De responsparameter ontbreekt.',
        'invalid-input-response': 'De responsparameter is ongeldig of misvormd.',
    }

Even better would be that translations (via existing gettext i18n?) for all supported languages are shipped with Flask WTF. Like with content of the widget, the browser's locale is used, but can also be overridden with:

    app.config['RECAPTCHA_PARAMETERS'] = {'hl': 'nl'}

It should work for recaptcha and hcaptcha. But overriding with a dict as shown above would be a good first step.

See also #583

@PanderMusubi
Copy link
Author

Oops, duplicate of #198

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant