It works fine now. Thanks a lot.
For curiosity: Isn't it possible to use the i18n transformer without the locale action anymore, or where was the error in my former approach.


Jonny

From: "Martinson, Theresa" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: <[EMAIL PROTECTED]>
Subject: RE: i18n - I can't get the simplest scenario going
Date: Thu, 16 Dec 2004 06:32:30 -0600

Try sending the locale parameter to your transformer in the foo pipeline. You can use the LocaleAction to get it.

Sample:

<map:action logger="sitemap.action.locale" name="locale" src="org.apache.cocoon.acting.LocaleAction">
<!-- this only creates a session if one doesn't already exist -->
<create-session>true</create-session>
<!-- this will store the locale string in the session -->
<store-in-session>true</store-in-session>


      <!--+
          | Default configuration:
      <locale-attribute>locale</locale-attribute>
      <create-session>false</create-session>
      <store-in-request>false</store-in-request>
      <store-in-session>false</store-in-session>
      <store-in-cookie>false</store-in-cookie>
      <use-locale>true</use-locale>
      <default-locale language="en" country="US"/>
          +-->
</map:action>


Then in the pipeline:

<map:act type="locale">
  <map:transform type="i18n">
        <map:parameter name="locale" value="{locale}"/>
  </map:transform>
</map:act>


Hope that helps.


Theresa



-----Original Message-----
From: Jonny Pony [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 16, 2004 6:22 AM
To: [EMAIL PROTECTED]
Subject: i18n - I can't get the simplest scenario going


Hi,

I'm struggling with the i18n-tranformer all morning. The simplest scenario
won't work. I'm trying to translate only one word in this example. I always
get the german translation, no matter what I do! I can send no parameter,
?locale=en or ?locale=de, I always get my translation always in german.

Where is the error?

Sitemap:
<?xml version="1.0"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0";>
        <map:components>
                <map:generators default="file"/>
                <map:transformers default="xslt">
                        <!-- Configure i18n transformer -->
                        <map:transformer name="i18n" 
logger="sitemap.transformer.i18n"
src="org.apache.cocoon.transformation.I18nTransformer">
                                <catalogues default="messages">
                                        <catalogue id="messages" name="messages" 
location="translations"/>
                                </catalogues>
                                
<untranslated-text>untranslated</untranslated-text>
                                <cache-at-startup>true</cache-at-startup>
                        </map:transformer>
                </map:transformers>
        </map:components>
        <map:pipelines>
                <map:pipeline>
                        <map:match pattern="foo">
                                <map:generate src="foo.xml"/>
                                <map:transform type="i18n"/>
                                <map:transform src="foo.xsl"/>
                                <map:serialize type="html"/>
                        </map:match>
                </map:pipeline>
        </map:pipelines>
</map:sitemap>

XML:
<?xml version="1.0" encoding="UTF-8"?>
<foo xmlns:i18n="http://apache.org/cocoon/i18n/2.1";>
        <foo>
                <translate>
                        <i18n:translate>
                                <i18n:text key="translate"/>
                        </i18n:translate>
                </translate>
        </foo>
</foo>

XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
        <xsl:template match="/">
                <html>
                        <head>
                                <title>i18n</title>
                        </head>
                        <body>
                                <p>
                                        <xsl:value-of select="/foo/translate"/>
                                </p>
                                <li>
                                                <a href="?locale=de">Deutsch</a>
                                        </li>
                                        <li>
                                                <a href="?locale=en">English</a>
                                        </li>
                        </body>
                </html>
        </xsl:template>
</xsl:stylesheet>

I got the messsages xmls in the translation folder:
messages.xml:
<?xml version="1.0" encoding="UTF-8"?>
<catalogue xml:lang="en">
    <message key="translate">User</message>
</catalogue>

messages_en.xml
<?xml version="1.0" encoding="UTF-8"?>
<catalogue xml:lang="en">
    <message key="translate">User</message>
</catalogue>

messages_de.xml
<?xml version="1.0" encoding="UTF-8"?>
<catalogue xml:lang="de">
    <message key="translate">Benutzer</message>
</catalogue>


Thanks Jonny

_________________________________________________________________
Die rote Karte f�r l�stige E-Mails. MSN Hotmail mit Junk-Mail-Filter.
http://www.msn.de/antispam/prevention/junkmailfilter Jetzt kostenlos
anmelden!


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


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


_________________________________________________________________
Machen Sie l�stigen E-Mails ein Ende. MSN Hotmail mit Junk-Mail-Filter. http://www.msn.de/antispam/prevention/junkmailfilter Jetzt kostenlos anmelden!



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



Reply via email to