I sense a mild friction here :) - whilst Massimo is a T() person, AChipa advocates in favour of gettext()!
AChipa's example is exactly what I have now, and I'm attempting to get away from it as quickly as possible. I could not agree more: word-by-word translation is plain suicide. For the moment, I'll stick to what I've come up with, merged with Massimo's XML(T()) solution. (i.e. writing the whole thing manually, formatting with "%s" and URL() for each href. That should yield a fairly graceful translation of the text. Thanks to both of you. On Jan 18, 2:08 pm, achipa <attila.cs...@gmail.com> wrote: > Alternatively, something along the lines of > > T("To %(link1) or %(link2) to be") % {'link1' : A(T("be"), > _href="..."), 'link2' : A(T("not"), _href="...")} > > might also work if you really want to keep the helpers for some > reason. > > Note that you probably don't want to do T() on single words as they > have a high chance of overlapping (for example "be" is not likely to > have a uniform translation in most languages). While tedious,in such > cases you should use a prefix and a dictonary for your base language, > too (since we don't have domains like gettext). > > On Jan 18, 7:50 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > I can think of other solutions but the one you propose seems the > > simplest one. > > > {{=XML(str(T("To <a href="%s">bla bla</a>",url)))}} > > > On Jan 17, 9:03 pm, Tari <robert.t...@gmail.com> wrote: > > > > Hello again, > > > > As I dive deeper and deeper into the (exciting) world of web2py, I > > > come to face increasingly tough challenges. I've searched and read the > > > discussions back and forth, yet could not find an acceptable solution > > > for my T() problem. > > > > Suppose you have to translate this entire expression, together with > > > the text A() renders: > > > > ("To ", A("Be", _href="..."), " or ", A("Not", _href="..."), " to Be") > > > > How would you set about it? > > > > Naturally, > > > > (T("To "), A(T("Be"), _href="..."), T(" or "), A(T("Not"), > > > _href="..."), T(" to Be")) > > > > is out of the question (word order, negation, etc.) > > > > The only way I can think of right now is to drop the A() helper and > > > write the whole text manually along with each <a> tag, then wrap it in > > > T(), and pray the links don't change... I really hope there is a less > > > painful way, both keeping the A() helper and translating the text in > > > its entirety. > > > > Thanks for the help. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---