为auth_user创建额外字段时,这些字段的验证消息始终为英语。他们不符合可用的翻译。
默认字段不会发生这种情况。
我把它添加到db.py中
auth.settings.extra_fields['auth_user'] = [
Field('pagination',
'integer',
default=9,
label=T('Pagination'),
notnull=True,
required=True,
requires=IS_INT_IN_RANGE(5, 51),
),
]
插入无效值时,返回的消息始终为
Enter an integer between 5 and 50
即使web2py语言不是英语,语言文件也可以使用正确的翻译。
该问题被确定为某些验证器使用该消息的方式中的错误。 web2py组中的更多详细信息。 https://groups.google.com/forum/#!searchin/web2py/extra_fields%7Csort:date/web2py/7O_h5YotOsQ/cZ7OM43yCAAJ