I think for now Anthony's proposal is the way to go. Open a ticket in google code and we can think of other options.
On Jul 20, 5:53 pm, Anthony <abasta...@gmail.com> wrote: > I think there are a few possibilities. First, your MultiT function could > work, but you'd have to use str(T(text)) instead of T(text). The reason is > that T() returns a lazyT object, not the translated string (it isn't > translated until rendering). You can force the translation by calling the > lazyT.__str__ method via str(T(text)). > > Another option is to define your own T() objects for each language and force > them to use the specific language. For example: > > In a model file: > from gluon.languages import translator > enT=translator(request) > enT.force('en-en') > esT=translator(request) > esT.force('es-es') > > In a view: > {{=esT('House')}} / {{=enT('House')}} > > It would probably be easy to abstract the above by defining a class that > stores multiple T objects and lets you easily add additional ones. > > A third option might be to create a special multi-language translation file. > For example, you could create a file called es-en.py, which could include > translations such as: > > 'House': 'Casa / House' > > Hope that helps. > > Anthony > > > > > > > > On Wednesday, July 13, 2011 1:22:23 PM UTC-4, demetrio wrote: > > Hi everyone, i don't know if "Simultaneous multi-language system" is > > the correct way to say what i need... i'll explain myself. > > > I'm developing an application that by request of our customer, needs > > to have 2 languages at the same time. For example, if this app were in > > spanish and english, in the navigator should appear something like: > > > Casa / House > > > In the view we want to do something like this > > > {{=T("House", "es-es")}} / {{=T("House", "en-en")}} > > > But i don't know if web2py can permit to do this or something like > > that. > > > I was thinking of writing a function like this: > > > def MultiT(text,separator=" / "): > > T.force("es-es") > > ret_text = T(text) > > T.force("en-en") > > ret_text += separator + T(text) > > return ret_text > > > But it does not work. Also, do not know how this affects the system > > when updating the language files with the strings to translate (now > > the files are updated automatically when pressing the "update > > languages" button in admin, and I guess that it would make it on run > > time. > > > Any sugestions? > > > Best regards > > Daniel