Because you're working with an attribute value, which isn't deemed
content per say, it's not text/cdata in the templating world.

Here's a proper i18n:name example from my own templates:

<h2 i18n:translate="">List of <tal:replace
                tal:replace="topic/title" i18n:name="title" /> Maps</h2>

Because you're manipulating a string that's meant as an attribute value,
that breaks the model somewhat.

You could try:

<a tal:attributes="href string:/?lang=${lang}" tal:define="lang

But where translate() is a function you defined somewhere.

That's how I handle these cases.  I have a utils.i18ntranslate()
function, which I can use through
modules/Products/MyProduct/utils/i18ntranslate (and in python code of
course, if needed).

The variable substitution available is meant to be used by message ID's,
and I don't expect a URL is used as a message ID ... Probably never
should.  The approach above seems to make more sense to me.

Anyways, that's how I do it (And I have a multilingual site, so I know
what you're going through!) :)


-----Original Message-----
From: Asheesh Laroia [mailto:[EMAIL PROTECTED] 
Sent: August 28, 2007 16:02
To: Doyon, Jean-Francois
Subject: RE: [Zope3-Users] Translations with variables embedded in

On Tue, 28 Aug 2007, Doyon, Jean-Francois wrote:

> Seems like you're trying to manipulate a string (a URL?) to do 
> translation within it, in which case you shouldn't do this within your

> TAL, but instead have a separate piece of logic to do it (Python 
> Script for example).

Translations can have variables in gettext.  All I'm trying to do is try
to handle a case of this variables substitution that the TAL syntax
makes hard.  I don't see why that justifies not using the built-in i18n
feature of Zope's TAL.

-- Asheesh.

"We live, in a very kooky time."
                -- Herb Blashtfalt
Zope3-users mailing list

Reply via email to