Thank a lot Massimiliano.
I've to remind to search more for solutions with the lambda function.

Il giorno giovedì 30 luglio 2015 09:38:01 UTC+2, Massimiliano ha scritto:
>
> Have you tried?
>
> db.cake.fruit.represent = lambda v, r: T(db.fruits[v].name)
> grid=SQLFORM.grid(db.cake)
>
>
> On Thu, Jul 30, 2015 at 8:55 AM, Gael Princivalle <gaelpri...@gmail.com 
> <javascript:>> wrote:
>
>> Hello all.
>>
>> Is it possible to translate data in SQLFORM.grid?
>>
>> MODEL:
>> db.define_table('fruits',
>>                 Field('name', type='string'),
>>                 format='%(name)s')
>>
>> db.define_table('cake',
>>                 Field('name', type='string'),
>>                 Field('fruit', 'reference fruits', requires = IS_IN_DB(db
>> , db.fruits.id, '%(name)s'), represent=lambda id, r: db.fruits[id].name))
>>
>> CONTROLLER:
>> grid=SQLFORM.grid(db.cake)
>>
>> VIEW:
>> {{=grid}}
>>
>> In the fruits table, names are in english, for example "Apple".
>>
>> Is it possible to set for this field in the grid automatic traductions 
>> like T()?
>>
>> In this case for example I would like to have in an Italian page "Mela" 
>> instead of "Apple".
>>
>> Thanks.
>>
>> -- 
>> 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+un...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Massimiliano
>  

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