[Catalyst] I18N with quotation marks

Cosimo Streppone cosimo at streppone.it
Wed Jul 8 15:58:32 GMT 2009


Gunnar Strand <gunnarstrand at yahoo.com> wrote:

> Ton Voon skrev:
>>
>> Final question: How do you internationalise a bit of text that does
>> want some markup within it? For instance, I want something that outputs:
>>
>> Click <a href="/about">here</a> for the about page.
>
> Wouldn't you need to send every part of the text through c.loc
> individually? I guess something like this:
>
> c.loc("Click ") _ link _ c.loc(" for the about page")

If you collect all your i18n messages into .po files,
that are worked on by translators, they have little or no
context information, so they are going to have a really
hard time figuring out the sense of words.

We internationalized a dynamic non-catalyst website in
19 languages now, and we found the following, in gettext notation,
to be the best for front-end and back-end developers
and translators.

   _('Click <a href="[_1]">here</a> for the about page')

So,

1) Keep the markup. It's ugly, but to us it's slightly better than
    the alternatives.

2) Variables as variables. This also conserves strings
    if/when you're changing URLs or variable content.
    Example:

    "You can upload up to [_1] Mb of pictures."

    As the string embeds the variable, your string won't need
    to be translated again if you change your upload limit.

3) Don't break sentences. In general, the longer, the better.
    In general.

-- 
Cosimo



More information about the Catalyst mailing list