Assuming
options = a retrieved list:string record

then
choices = dict([(x,T(x)) for x in options])

should work. Note: untested.


On Apr 7, 3:29 am, niknok <[email protected]> wrote:
> Thanks DenesL.
>
> What if the options are retrieved from a field of list:string type?
>
> On Apr 4, 10:39 pm, DenesL <[email protected]> wrote:
>
>
>
>
>
>
>
> > Use
>
> > choices = {'Gold':T('Gold'), 'Silver':T('Silver')}
>
> > and update your language translations strings.
> > Not sure how "answer" is obtained.
>
> > On 4 abr, 09:16, niknok <[email protected]> wrote:
>
> > > I tried:
> > > Field('color', 'list:string', default=answer,
> > > requires=IS_IN_SET(T(question['choices']), zero=None, multiple=True))
>
> > > I would like to display the choices in the translated language but the
> > > selection will be stored in the database in the orginal language. For
> > > example:
>
> > > choices = ['Gold', 'Silver']
> > > What the user sees: ['Oro', 'Plata']
> > > What is stored in the database (as the case, maybe): |Gold|Silver|
>
> > > And if I need to display the selection (default=answer), Oro and Plata
> > > will be re-selected.

Reply via email to