Yes, I have tried it too and the translation works very fine. But my problem
is: how to get the original strings 'Yes' and 'No'
I have forced a language with no translation (in my example
T.force('fr-fr')) and I thought, this would give the original strings. But I
got again the German strings. T.accepted-language is really 'fr-fr'.

2011/6/30 Bruno Rocha <[email protected]>

> I just tested it and works perfectly.
>
> Are you sure do you have the string translated in language file?
>
> My test:
>
> T.force('pt-br')
> print T.accepted_language # printed ok pt-br in terminal
>
> myset = [ ('Y', T('Yes')), ('N', T('No')) ]
>
> db.define_table('question',
>                 Field('my_question',
>                       requires = [IS_IN_SET(myset)],
>                       widget = SQLFORM.widgets.checkboxes.widget,
>                       default = T('No'),
>                       )
>                 )
>
>
> I got "Sim" , "Não" in portuguese.
>
> But I needed to update my language files.
>
> On Thu, Jun 30, 2011 at 4:55 PM, Martin Weissenboeck 
> <[email protected]>wrote:
>
>> Great, thank you - it solves the "_value"-problem.
>>
>> But the other problem is not solved: I get only the translated version
>> (German), not dependig on the selected language.
>> I have tried it with T.force('fr-fr') [there is no French translation]. I
>> have expected 'Yes' and 'No', but I got again 'Ja' and 'Nein'.
>>
>> And: how to set the default value?
>>
>>
>> 2011/6/30 Bruno Rocha <[email protected]>
>>
>>> IS_IN_SET( [ ('Y',T('Yes')), ('N',T('No')) ] )
>>>
>>> Is in set, can receive a list of tuples, where first element is value,
>>> second is text.
>>>
>>>
>>> On Thu, Jun 30, 2011 at 4:31 PM, Martin Weissenboeck <[email protected]
>>> > wrote:
>>>
>>>> Hi,
>>>>
>>>> I want to use a SQLFORM with a checkbox. I have tried
>>>>
>>>> ... Field('my_question',
>>>>
>>>> requires=[IS_IN_SET([T('Yes'),T('No')]),],
>>>>
>>>> widget=SQLFORM.widgets.checkboxes.widget,
>>>>
>>>> default=T('No'),
>>>>
>>>>     ),...
>>>>
>>>> I got a nice form with the German translations 'Ja' and 'Nein'.
>>>> But now I did not get the English version.
>>>>
>>>> A SELECT like
>>>>
>>>> ... SELECT(
>>>>       OPTION(T('Yes'), _value='Y'),
>>>>       OPTION(T('No'), _value='N'),
>>>>       ) ...
>>>>
>>>>
>>>> works depending on the T-language, but I don't know how to put a
>>>> "_values" into the SQLFORM.
>>>>
>>>> Any hints?
>>>> Regards, Martin
>>>>
>>>
>>>
>>>
>>> --
>>>
>>>
>>>
>>> --
>>> Bruno Rocha
>>> [ About me: http://zerp.ly/rochacbruno ]
>>> [ Aprenda a programar: http://CursoDePython.com.br ]
>>> [ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
>>> [ Consultoria em desenvolvimento web: http://www.blouweb.com ]
>>>
>>>
>>
>>
>
>
> --
>
>
>
> --
> Bruno Rocha
> [ About me: http://zerp.ly/rochacbruno ]
> [ Aprenda a programar: http://CursoDePython.com.br ]
> [ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
> [ Consultoria em desenvolvimento web: http://www.blouweb.com ]
>
>

Reply via email to