If you want to translate the field names you can do:
Field('option','string',requires=IS_NOT_NULL,unique=True,label=T
('option')))
If you want to translate the actual options than you must use
IS_IN_SET instead of IS_IN_DB.
Things in DB are meant to be dynamical while translations are static
(they are stored in a file, not in db).
Massimo
On Sep 6, 10:08 am, weheh <[email protected]> wrote:
> # Model:
> db.define_table('optionlist',
> Field('option','string',requires=IS_NOT_NULL,unique=True))
> db.define_table('table2',
> Field('name','string','requires=IS_NOT_NULL,unique=True),
> Field('option',db.optionlist,requires=IS_IN_DB(db,'optionlist.id','%
> (option)s')))
>
> # Controller:
> form = SQLFORM(db.table2)
>
> # Now, the view will show the optionlist as a drop-down list in the
> browser, which is what I want.
>
> Issue: How would I apply translation with the T() function to all the
> fields in the optionlist? I tried a couple of different things but
> they didn't work. Is this even possible?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---