在Recaptcha中设置语言-Flask

use*_*084 5 python recaptcha flask wtforms flask-wtforms

当用户忘记选中recaptcha复选框时,我正在尝试更改错误消息。即使将语言设置为pt后,我仍然收到此消息:The response parameter is missing.

from flask.ext.wtf import Form, RecaptchaField

recaptcha = RecaptchaField()
Run Code Online (Sandbox Code Playgroud)
RECAPTCHA_PUBLIC_KEY = 'yyyy'
RECAPTCHA_PRIVATE_KEY = 'xxxx'
RECAPTCHA_PARAMETERS = {'hl': 'pt'}
Run Code Online (Sandbox Code Playgroud)

- 此处的语言代码

-关于Recpacha的 docs1 docs2

如何更改这些消息的语言?

编辑:即使升级到flask-wtforms的最新版本之后,错误消息仍然始终是英文。仅标签会更改。

相关源代码

Ana*_*ana 3

我认为他们当前的实现不可能:

https://github.com/lepture/flask-wtf/blob/8879e9827b0160776031bd06ef083b81282904e5/flask_wtf/recaptcha/widgets.py#L8

他们对库进行了硬编码 URL: https: //www.google.com/recaptcha/api.js

但对于不同的语言设置,应该在 recaptcha URL 中传递 GET 参数,例如: https: //www.google.com/recaptcha/api.js ?hl=ru

我必须手动覆盖字段和验证才能使用不同的语言设置。