Hello,

Is is possible translate a data in a SQLFORM?

Where my controller is:

form=SQLFORM(db.cake)

And my view:

{{=form}}

thanks.

Em quinta-feira, 30 de julho de 2015 04:38:01 UTC-3, Massimiliano escreveu:
>
> 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 <[email protected] 
> <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 [email protected] <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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to