cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@cocoon.apache.org
Subject [Cocoon Wiki] Updated: I18NTransformer
Date Fri, 30 Jul 2004 09:59:07 GMT
   Date: 2004-07-30T02:59:07
   Editor: ArjeCahn <a.cahn@hippo.nl>
   Wiki: Cocoon Wiki
   Page: I18NTransformer
   URL: http://wiki.apache.org/cocoon/I18NTransformer

   no comment

Change Log:

------------------------------------------------------------------------------
@@ -33,53 +33,42 @@
  * Locale-based content filtering (2.1 version)
  * Markup in translations (2.1 version)
  * Named substitution parameters (2.1 version)
+ * Multiple catalogues
 
 
 == Detailed description ==
 This description supposes that you first defined a '''catalogue''' file like the following
:
 message.xml
-{{{
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<catalogue xml:lang="fr">
-  <message key="aKey">Une clé</message>
-  ...
-  <message key="zipcode">Code postal</message>
-</catalogue>
+{{{
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<catalogue xml:lang="fr">
+  <message key="aKey">Une clé</message>
+  ...
+  <message key="zipcode">Code postal</message>
+</catalogue>
 }}}
 You also must configure the main cocoon '''sitemap''' like this :
-{{{
-    <map:transformers>
-      <map:transformer     name="i18n"
-        src="org.apache.cocoon.transformation.I18nTransformer">
-        <catalogue-name>messages</catalogue-name>
-        <catalogue-location>../../translations</catalogue-location>
-	<cache-at-startup>true</cache-at-startup>
-      </map:transformer>
-    </map:transformers>
-}}}
-If you want to use multiple catalogues, you can use this:
-{{{
-    <map:transformers>
-      <map:transformer name="i18n" src="org.apache.cocoon.transformation.I18nTransformer">
-        <catalogues default="other">
-          <catalogue id="other" name="OtherMessages" location="../../translations"/>
-          <catalogue id="woody" name="WoodyMessages" location="../../translations"/>
-        </catalogues>
-        <cache-at-startup>true</cache-at-startup>
-      </map:transformer>
-    </map:transformers>
+{{{
+    <map:transformers>
+      <map:transformer     name="i18n"
+        src="org.apache.cocoon.transformation.I18nTransformer">
+        <catalogue-name>messages</catalogue-name>
+        <catalogue-location>../../translations</catalogue-location>
+	<cache-at-startup>true</cache-at-startup>
+      </map:transformer>
+    </map:transformers>
 }}}
 Here is the way to call it in a '''pipeline''' : 
-{{{
-<map:pipelines>
-  <map:pipeline>
-    <map:match pattern="mypage.html">
-      <map:generate src="mypage.html"/>
-      <map:transform type="i18n"/>
-      <map:serialize type="html"/>
-    </map:match>
-  </map:pipeline>
-</map:pipelines>
+{{{
+<map:pipelines>
+  <map:pipeline>
+    <map:match pattern="mypage.html">
+      <map:generate src="mypage.html"/>
+      <map:transform type="i18n"/>
+      <map:serialize type="html"/>
+    </map:match>
+  </map:pipeline>
+</map:pipelines>
 }}}
 Here is now how you can internationalize items :
 === Plain text translation[[BR]] ===
@@ -89,6 +78,34 @@
 === Parameter substitution ===
 === Substitution parameter translation ===
 === Date, time, number and currency formatting ===
+=== Multiple catalogues ===
+If you want to use multiple catalogues, you can use this:
+{{{
+    <map:transformers>
+      <map:transformer name="i18n" src="org.apache.cocoon.transformation.I18nTransformer">
+        <catalogues default="other">
+          <catalogue id="other" name="OtherMessages" location="../../translations"/>
+          <catalogue id="woody" name="WoodyMessages" location="../../translations"/>
+        </catalogues>
+        <cache-at-startup>true</cache-at-startup>
+      </map:transformer>
+    </map:transformers>
+}}}
+
+Refer to the correct catalogue in your pipeline using the "default-catalogue-id" parameter:
+{{{
+<map:pipelines>
+  <map:pipeline>
+    <map:match pattern="mypage.html">
+      <map:generate src="mypage.html"/>
+      <map:transform type="i18n">
+         <map:parameter name="default-catalogue-id" value="woody"/>
+      </map:transform>
+      <map:serialize type="html"/>
+    </map:match>
+  </map:pipeline>
+</map:pipelines>
+}}}
 
 
 To be continued ...
@@ -96,25 +113,25 @@
 
 ==  Problem with Cocoon 2.1 ==
 if you get
-{{{
-java.lang.NullPointerException
-        at org.apache.cocoon.components.ExtendedComponentSelector.release(ExtendedComponentSelector.java:317)
-        at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.recycle(AbstractProcessingPipeline.java:639)
-        at org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.recycle(AbstractCachingProcessingPipeline.java:970)
-        at org.apache.avalon.excalibur.pool.ResourceLimitingPool.put(ResourceLimitingPool.java:438)
-
-...
-java.lang.IllegalStateException: You cannot lookup components on a disposed ComponentLocator
-        at org.apache.avalon.excalibur.component.ExcaliburComponentManager.lookup(ExcaliburComponentManager.java:199)
-        at org.apache.cocoon.components.CocoonComponentManager.lookup(CocoonComponentManager.java:315)
-
-...
+{{{
+java.lang.NullPointerException
+        at org.apache.cocoon.components.ExtendedComponentSelector.release(ExtendedComponentSelector.java:317)
+        at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.recycle(AbstractProcessingPipeline.java:639)
+        at org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.recycle(AbstractCachingProcessingPipeline.java:970)
+        at org.apache.avalon.excalibur.pool.ResourceLimitingPool.put(ResourceLimitingPool.java:438)
+
+...
+java.lang.IllegalStateException: You cannot lookup components on a disposed ComponentLocator
+        at org.apache.avalon.excalibur.component.ExcaliburComponentManager.lookup(ExcaliburComponentManager.java:199)
+        at org.apache.cocoon.components.CocoonComponentManager.lookup(CocoonComponentManager.java:315)
+
+...
 }}}
 
 for Cocoon 2.1, then make sure your namespace reads
 
-{{{
-xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+{{{
+xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
 }}}
 
 instead of "2.0"... [[BR]]

Mime
View raw message