You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Robin Rigby <ro...@gondolier.org.uk> on 2007/07/02 14:32:46 UTC
Attributes in i18n
How do I do this, please? None of these work:
<catalogue>
<message key="message1">Click the <a href="{0}">link</a></message>
<message key="message2">Click the <a
href="{0}">link</a></message>
<message key="message3">Click the<![CDATA[<a
href="{0}">]]>link<![CDATA[</a>]]></message>
<message key="message4">Click the {0}link{1}</message>
</catalogue>
<page xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
<p><i18n:translate><i18n:text key="message1"/>
<i18n:param>page.html</i18n:param></i18n:translate></p>
<p><i18n:translate><i18n:text key="message2"/>
<i18n:param>page.html</i18n:param></i18n:translate></p>
<p><i18n:translate><i18n:text key="message3"/>
<i18n:param>page.html</i18n:param></i18n:translate></p>
<p><i18n:translate><i18n:text key="message4"/>
<i18n:param><![CDATA[<a href="page.html">]]></i18n:param>
<i18n:param><![CDATA[</a>]]></i18n:param></i18n:translate></p>
</page>
<result>
<p>Click the <a href="{0}">link</a></p>
<p>Click the <a href="page.html">link</a></p>
<p>Click the <a href="page.html">link</a></p>
<p>Click the <a href="page.html">link</a></p>
</result>
The i18n:attr feature seems to solve a different problem.
The result I want, of course, is
<p>Click the <a href="page.html">link</a></p>
Thanks
Robin Rigby
robin@gondolier.org.uk
http://www.gondolier.org.uk
07785 765017
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Attributes in i18n
Posted by Joerg Heinicke <jo...@gmx.de>.
On 02.07.2007 14:32, Robin Rigby wrote:
> How do I do this, please? None of these work:
>
> <catalogue>
> <message key="message1">Click the <a href="{0}">link</a></message>
> </catalogue>
That's indeed not supported (yet):
https://issues.apache.org/jira/browse/COCOON-2057.
> The i18n:attr feature seems to solve a different problem.
Yes, it only points to an attribute that is to be translated. IIRC the
content of this attribute is taken as message key.
> The result I want, of course, is
>
> <p>Click the <a href="page.html">link</a></p>
The only work around that I have in mind at the moment is to do
something like
<message key="message1">Click the <a><href>{0}</href>link</a></message>
and to postprocess this with a little XSLT.
<xsl:template match="a[href]">
<xsl:copy>
<xsl:attribute name="href">
<xsl:value-of select="href"/>
</xsl:attribute>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="node()">
<!-- generic match for copying all and everything -->
</xsl:template>
Regards
Jörg
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org