cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martinson, Theresa" <Theresa.Martin...@personneldecisions.com>
Subject RE: i18n - I can't get the simplest scenario going
Date Thu, 16 Dec 2004 13:32:18 GMT
In the 2.1 API documentation for i18n transformer, it looks like you have to do it this way.


Back when I was first trying to get it to work, I think I read somewhere that the current
cocoon version does require this locale parm into the transformer.  But I don't remember any
other specifics.  I did hit the same problem as you though, so it was fresh in my mind.

I'm glad that worked for you!

Theresa 


-----Original Message-----
From: Jonny Pony [mailto:jonnypony666@hotmail.com] 
Sent: Thursday, December 16, 2004 7:23 AM
To: users@cocoon.apache.org
Subject: RE: i18n - I can't get the simplest scenario going


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" <Theresa.Martinson@personneldecisions.com>
>Reply-To: users@cocoon.apache.org
>To: <users@cocoon.apache.org>
>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:jonnypony666@hotmail.com]
>Sent: Thursday, December 16, 2004 6:22 AM
>To: users@cocoon.apache.org
>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: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>

_________________________________________________________________
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: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message