All suggestion here are good solution that I used... Though the last
suggestion by Francisco set the limit I didn't workaround yet... I mean how
to make orderby base on the translation?!

Richard


On Wed, Dec 18, 2013 at 12:11 PM, Francisco Costa
<[email protected]>wrote:

> Check
> http://stackoverflow.com/questions/12055856/how-to-apply-language-translation-on-requires-field-when-showing-other-table-fie
>
> I would go with IS_IN_DB(db, db.t_title.id, lambda r: T(r.name), orderby=
> db.t_title.id)
>
>
> On Monday, December 26, 2011 9:14:55 PM UTC, Alan Etkin wrote:
>>
>> And what about using the represent attribute?:
>>
>> db.mytable.myfield.represent = lambda myfield, r: T(myfield)
>>
>> On 26 dic, 17:54, Mathias Van Daele <[email protected]> wrote:
>> > My goal is the following :
>> >
>> > If I make a SQL/CRUD form for a person object,
>> > then the third attribute to set is the size.
>> > I have to choose the value from a selection list.
>> > (IS_IN_DB(db,'size.name'))
>> >
>> > In the selection list, I can't get the translated values.
>> > Unfortunately, that is exactly what I want.
>> >
>> > Translating the values from the table "list", is not a problem.
>> >
>> > For instance with the following function, I can show the translated
>> value
>> > on a page.
>> >
>> > rows=db(db.size.id>0).select()
>> > for row in rows:
>> >    content=T('row.name')
>> >    return content
>> >
>> > But how can I get the translated values in the selection list ?
>> >
>> > Thanks for your help
>> >
>> > Op 26 december 2011 20:00 schreef Alexandre Andrade <
>> > [email protected]> het volgende:
>> >
>> > > T('mycontent') is the function for translation in web2py.
>> >
>> > > You can throw the content of a field to it
>> >
>> > > content = T(row.contentfield)
>> >
>> > > and it will appear at translation files to translate.
>> >
>> > > Since u apply it just to a few fields/rows/tables, it can work fine.
>> >
>> > > But for large contents, you will need a tool/api to automate
>> translation,
>> > > and use a function to call it.
>> >
>> > > Alexandre Andrade
>> >
>> > > 2011/12/26 Mathias Van Daele <[email protected]>
>> >
>> > >> Hey Anthony, thanks for your answer !
>> >
>> > >> Your solution for question 1 working fine !  (with label)
>> > >> For questions 2 I am still trying...
>> >
>> > >> Mathias
>> >
>> > >> Op 26 december 2011 19:06 schreef Anthony <[email protected]> het
>> > >> volgende:
>> >
>> > >>  Concerning question 1 : How can I translate
>> > >>>> "name_father","name_mother",..**. in a form from this table ?
>> >
>> > >>> Field() takes a "label" argument, which I think you should be able
>> to
>> > >>> translate:
>> >
>> > >>> Field('name_father', ..., label=T('Father Name'))
>> >
>> > >>> If that doesn't work, try T('Father Name', lazy=False), which
>> > >>> immediately translates and returns a string.
>> >
>> > >>>> Concerning question 2 : Suppose table "size" contains some values
>> like
>> > >>>> "big","small"...
>> > >>>> I am looking for a function to get these values translated too.
>> >
>> > >>> In places where you display results, you could put the outputs
>> inside
>> > >>> T(), as usual. I haven't tried it, but using the field's
>> "represent"
>> > >>> attribute (
>> > >>>http://web2py.com/books/default/chapter/29/6#Record-representation)
>> or
>> > >>> a virtual field (
>> > >>>http://web2py.com/books/default/chapter/29/6#New-
>> style-virtual-fields...))
>> > >>> might work as well, depending on what you're doing.
>> >
>> > >>> Anthony
>> >
>> > > --
>> > > Atenciosamente
>> >
>> > > Alexandre Andrade
>> > > Hipercenter.com Classificados Gratuitos
>> >
>> >
>
>  --
> 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/groups/opt_out.
>

-- 
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/groups/opt_out.

Reply via email to