The problem is unique to the IS_*_IN_RANGE validators, all of which create 
a translated error message at the time they are instantiated rather than at 
validation time. For example, here is the init code for 
IS_INT_IN_RANGE: 
https://github.com/web2py/pydal/blob/e973f27b69a8499e4e30e5663f3fba74bf87364c/pydal/validators.py#L817.

So, you need to set the translation language before defining one of these 
validators. Note, this has nothing to do with Auth extra_fields, just with 
the point in the code at which the validators are defined.

I don't see why the error message logic cannot be moved from the __init__ 
method to the validate method in these range validators, which would push 
the translation to validation time, as with all the other validators. So, 
feel free to submit an issue about this in the pydal repo and refer to this 
post (or better yet, make a pull request).

Anthony

On Saturday, April 6, 2019 at 2:07:16 PM UTC-4, João Matos wrote:
>
> The app will start in Portuguese. You can change that by uncommenting the 
> T.force() in db1.py, but it would be good to do the testing with Portuguese 
> first to see the problem.
> After registering, create a new record and in the field ùltimo atribuído 
> (last_assigned) input -1 which will return a validation error message in 
> Portuguese (correct behavior).
> If you go to Perfil (Profile) and to the same to one of the Paginação 
> (Pagination) fields it will return a validation error message in English 
> (the pagination fields are the extra_fields).
> If you comment the T.force() from db1.py and uncomment the T.force() that 
> is present in db.py before the extra_fields creation and redo the 2 tests, 
> you will see that both who in Portuguese.
>
> I'm unable to add the app file as an attachment. It always returns an 
> error.
> So you can find it in WeTransfer in this link
>
> https://wetransfer.com/downloads/5d1a0f5303b2a61ee27f64a9ce73ed7c20190406180555/90183abbd7bf1cbaab5ab1011cbdafed20190406180555/81e5a8
>
>

-- 
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