{{=T('<b>Howto</b>')}}

2 views
Skip to first unread message

hcvst

unread,
Aug 15, 2009, 7:22:25 AM8/15/09
to web2py-users
Hi,

I am sure I've seen this question here before but I cannot find it.
Can one translate an entire paragraph including the markup?

HC

hcvst

unread,
Aug 15, 2009, 7:34:09 AM8/15/09
to web2py-users
Is it
{{=XML(T('<b>Howto</b>'))}}
One tends to find an answer only ever after submitting a question.

Iceberg

unread,
Aug 16, 2009, 10:12:56 AM8/16/09
to web2py-users
Your answer might work, but I would suggest B(T('Howto')). The point
is to separate language string (the "Howto") from appearance (the
"<b>...</b>").

hcvst

unread,
Aug 16, 2009, 10:47:33 AM8/16/09
to web2py-users
Hi Iceberg,

it's a lengthy paragraph and I want to be able to translate it as one
because
the other language's word order is different.
Is there a better way?

How would one translate for example:

"""
<b>Caipirinha</b> is <a href="/wiki/Brazil" title="Brazil">Brazil</
a>'s national cocktail, made with <a href="/wiki/Cacha%C3%A7a"
title="Cachaça">cachaça</a>
""" (from wikipedia)

into

"""
<a href="/wiki/Brazil" title="Brazil">Brazil</a>'s national cocktail,
made with <a href="/wiki/Cacha%C3%A7a" title="Cachaça">cachaça</a> is
<b>Caipirinha</b>
"""

That was my problem.

HC

Iceberg

unread,
Aug 16, 2009, 11:40:49 AM8/16/09
to web2py-users
Now I understand your headache. I felt that before when my application
needed to provide a lengthy manual in different languages. Eventually
I think "lengthy paragraph translating" is beyond the scope of any
"simple" i18n mechanism. So I decided to not bother the i18n, just
solve it via a raw way: prepare and maintain a manual_en.html and a
manual_bz.html and ... etc by human. Of course you can still "abuse"
the i18n mechanism to do the same thing, it works but merely
efficient: any slight change of source string forces you to re-
translate the whole paragraph again.

Sorry that my feedback doesn't provide any substantial help.

Regards,
Iceberg

hcvst

unread,
Aug 20, 2009, 9:23:43 AM8/20/09
to web2py-users
Thanks for your reply Iceberg. You're of course right. I didn't
consider that changing the original
effectively changes the lookup key - but for my app that's fine. In
general one should probably have
separate files.

HC
> > > > > HC- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -
Reply all
Reply to author
Forward
0 new messages