> -----Original Message-----
> From: Matthieu Sozeau [mailto:[EMAIL PROTECTED]] 
> Sent: Saturday, April 06, 2002 1:10 PM
> To: Cocoon Users
> Subject: I18n and Cocoon2
> 
> 
> I've got some questions/feature requests for the i18n transformer:
> 
> 1) When I have large chunks of data containing markup (say 
> <href...) i want to translate, must I divide each fragment of 
> text with keys? If I use params, i can't use markup either, 
> since it looks like they are not directly put in place of {*} 
> "anchors":

This is the worst limitation of i18n transformer and it is in my todo list,
but currently I'm too work on it. So, patches are welcome.

> 
> Source: 
> -<i:translate>
>        <i:text i:key="songs_ogg"> These files are {0} 
> encoded, a format similar to the mp3 but which is totally 
> free (source code, algorithms...) and more powerful. If u use 
> windows and {1} you may whish to download the {2}. Under 
> linux, it's commonly installed with {3} or {4}. </i:text>
> 
> -<i:param>
>        <href url="http://www.vorbis.com"label="oggVorbis"vers="_new"/>
>  </i:param>
> -<i:param>
>       <href url="http://www.winamp.com"label="winamp"vers="_new"/>
>  </i:param>
> -<i:param>
>        <href url="./progs/Nullsoft_Vorbis_Decoder.exe"label="plugin"/>
>  </i:param>
> -<i:param>
>       <href url="http://www.xmms.org"vers="_blank"label="XMMS"/>
>  </i:param>
> -<i:param>
>        <href 
> url="http://www.freeamp.org"vers="_blank"label="FreeAmp"/>
>  </i:param>
>  </i:translate>
> 
> Pipeline:
> 
> <map:match pattern="*.html">
>       <map:generate src="pages/index.xml"/>
>       <map:transform src="stylesheets/view.xsl">
>         <map:parameter name="view" value="pages/{1}.xml"/>
>       </map:transform>
> <map:transform type="cinclude"/>
> <map:transform type="i18n"/>
> 
>       Translates <href to <a href...
> <map:transform src="stylesheets/index.xsl"/>
> <map:serialize type="xhtml"/>
> </map:match>
> 
> 
> Output:
> -<p>
>  <a title=""href="http://www.vorbis.com";>oggVorbis</a>
>  <a title=""href="http://www.winamp.com";>winamp</a>
>  <a title=""href="/files/Nullsoft_Vorbis_Decoder.exe">plugin</a>
>  <a title=""href="http://www.xmms.org";>XMMS</a>
>  <a title=""href="http://www.freeamp.org";>FreeAmp</a>
> These files are null encoded, a format similar to the mp3 but 
> which is totally free (source code, algorithms...) and more 
> powerful. If u use windows and null you may whish to download 
> the null. Under linux, its commonly installed with {3} or {4}.
>  </p>

So, you need XML content in params and maybe XML content in translation
text:
<i18n:text>This is a <a href="">{0}</a></i18n:text>.

> 
> --------------------------------
> 
> 
> 2)Is there any way for doing in-place translations like:
>       <i18n:translate type="inplace">
>               <en>Hello</en>
>               <fr>Bonjour</fr>
>       </i18n:translate>
>       
> thus overriding catalogues?

No, there is no. I've been thinking about something like:
<i18n:choose>
        <i18n:when test="en">Hello</i18n:when>
        <i18n:when test="ru">Привет</i18n:when>
</i18n:choose>

This would allow not only text output, but also some conditional code. But
your version looks better. So, again, patches are welcome.

Regards,
Konstantin Piroumian

> 
> 
> -- 
> "Black holes are where God divided by zero." - Steven Wright
> 
> MaT|TaM
> 

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to