[英]Django text in form is not translating
I have the following code in my forms.py:我的forms.py中有以下代码:
def field_validate(self, request):
try:
id_exists(request, self["user"].data)
except:
self.add_error('user', ugettext_lazy("id is not available"))
the problem is when my 'user' filed is not validated in my field_validate function, the error is displayed in English, however other texts in my whole project are translating.问题是当我的 field_validate 函数中未验证我的“用户”字段时,错误以英文显示,但是我整个项目中的其他文本正在翻译。 using ugettext_lazy nor ugettext solved the problem.使用 ugettext_lazy 或 ugettext 解决了这个问题。
Is there anything I am missing?有什么我想念的吗?
tnx tnx
整个问题是因为在 django.po 文件中,在翻译上方有一个#fuzzy阻止了选项被翻译!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.