I have confirmed that it is indeed a bug in web2py.
If I add
T.force('pt')


before

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), ), ] 


the validation messages all come out in Portuguese (even if I change the 
language to English).

So the problem is that the code for the extra_fields is not language 
independent.


sexta-feira, 5 de Abril de 2019 às 16:43:35 UTC+1, João Matos escreveu:
>
> No, I think it is a web2py bug. I reported it in Git.
>
> sexta-feira, 5 de Abril de 2019 às 15:57:30 UTC+1, Kevin Keller escreveu:
>>
>> Wow that must be annoying. 
>>
>> Did you find any workaround? 
>>
>> On Thursday, 4 April 2019 21:25:10 UTC+2, João Matos wrote:
>>>
>>> When creating extra fields for auth_user, the validation messages for 
>>> those fields are always in English. They don't comply with the translations 
>>> available.
>>>
>>> This does not happen on the default fields.
>>>
>>>
>>> I added this to 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))] 
>>>
>>>
>>> When inserting an invalid value, the returned message is always
>>>
>>> Enter an integer between 5 and 50
>>>>
>>> even when the web2py language is not English and the languages files 
>>> have the correct translation available.
>>>
>>>
>>> web2py 2.18.4
>>> Python 3.7.1 x86
>>> Firefox 66.0.2 x64
>>> Windows 7 Pro x64 SP1+all updates
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to