You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by he...@apache.org on 2005/10/12 13:53:33 UTC

svn commit: r314854 - in /cocoon/branches/BRANCH_2_1_X/src/webapp: samples/common/i18n/ samples/common/i18n/messages.xml samples/common/i18n/messages_fr.xml samples/common/i18n/messages_nl.xml samples/sitemap.xmap stylesheets/system/calendar2html.xslt

Author: hepabolu
Date: Wed Oct 12 04:53:15 2005
New Revision: 314854

URL: http://svn.apache.org/viewcvs?rev=314854&view=rev
Log:
Patches applied from Bug 37030.

Added:
    cocoon/branches/BRANCH_2_1_X/src/webapp/samples/common/i18n/
    cocoon/branches/BRANCH_2_1_X/src/webapp/samples/common/i18n/messages.xml
    cocoon/branches/BRANCH_2_1_X/src/webapp/samples/common/i18n/messages_fr.xml
    cocoon/branches/BRANCH_2_1_X/src/webapp/samples/common/i18n/messages_nl.xml
Modified:
    cocoon/branches/BRANCH_2_1_X/src/webapp/samples/sitemap.xmap
    cocoon/branches/BRANCH_2_1_X/src/webapp/stylesheets/system/calendar2html.xslt

Added: cocoon/branches/BRANCH_2_1_X/src/webapp/samples/common/i18n/messages.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/webapp/samples/common/i18n/messages.xml?rev=314854&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/webapp/samples/common/i18n/messages.xml (added)
+++ cocoon/branches/BRANCH_2_1_X/src/webapp/samples/common/i18n/messages.xml Wed Oct 12 04:53:15 2005
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!--+
+    | Default (English) message catalogue file for Cocoon 2 CalendarGenerator sample
+    |
+    | CVS $Id:  $
+    +-->
+    
+    <catalogue xml:lang="en">
+        <message key="SUNDAY">Sunday</message>
+        <message key="MONDAY">Monday</message>
+        <message key="TUESDAY">Tuesday</message>
+        <message key="WEDNESDAY">Wednesday</message>
+        <message key="THURSDAY">Thursday</message>
+        <message key="FRIDAY">Friday</message>
+        <message key="SATURDAY">Saturday</message>
+    </catalogue>
+    

Added: cocoon/branches/BRANCH_2_1_X/src/webapp/samples/common/i18n/messages_fr.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/webapp/samples/common/i18n/messages_fr.xml?rev=314854&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/webapp/samples/common/i18n/messages_fr.xml (added)
+++ cocoon/branches/BRANCH_2_1_X/src/webapp/samples/common/i18n/messages_fr.xml Wed Oct 12 04:53:15 2005
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!--+
+    | French message catalogue file for Cocoon 2 CalendarGenerator sample
+    |
+    | CVS $Id:  $
+    +-->
+    
+    <catalogue xml:lang="fr">
+        <message key="SUNDAY">dimanche</message>
+        <message key="MONDAY">lundi</message>
+        <message key="TUESDAY">mardi</message>
+        <message key="WEDNESDAY">mercredi</message>
+        <message key="THURSDAY">jeudi</message>
+        <message key="FRIDAY">vendredi</message>
+        <message key="SATURDAY">samedi</message>
+    </catalogue>
+    

Added: cocoon/branches/BRANCH_2_1_X/src/webapp/samples/common/i18n/messages_nl.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/webapp/samples/common/i18n/messages_nl.xml?rev=314854&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/webapp/samples/common/i18n/messages_nl.xml (added)
+++ cocoon/branches/BRANCH_2_1_X/src/webapp/samples/common/i18n/messages_nl.xml Wed Oct 12 04:53:15 2005
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!--+
+    | Dutch message catalogue file for Cocoon 2 CalendarGenerator sample
+    |
+    | CVS $Id:  $
+    +-->
+    
+    <catalogue xml:lang="nl">
+        <message key="SUNDAY">Zondag</message>
+        <message key="MONDAY">Maandag</message>
+        <message key="TUESDAY">Dinsdag</message>
+        <message key="WEDNESDAY">Woensdag</message>
+        <message key="THURSDAY">Donderdag</message>
+        <message key="FRIDAY">Vrijdag</message>
+        <message key="SATURDAY">Zaterdag</message>
+    </catalogue>
+    

Modified: cocoon/branches/BRANCH_2_1_X/src/webapp/samples/sitemap.xmap
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/webapp/samples/sitemap.xmap?rev=314854&r1=314853&r2=314854&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/webapp/samples/sitemap.xmap (original)
+++ cocoon/branches/BRANCH_2_1_X/src/webapp/samples/sitemap.xmap Wed Oct 12 04:53:15 2005
@@ -26,7 +26,18 @@
    <map:generator name="linkstatus" src="org.apache.cocoon.generation.LinkStatusGenerator"/>
    <map:generator name="calendar" src="org.apache.cocoon.generation.CalendarGenerator"/>
   </map:generators>
- </map:components>
+ 
+  <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="common/i18n"/>
+    </catalogues>
+    <cache-at-startup>true</cache-at-startup>
+    </map:transformer>
+   </map:transformers>
+  </map:components>
+ 
 
 <!-- =========================== Views =================================== -->
 
@@ -179,12 +190,13 @@
       <map:parameter name="country" value="{request-param:country}"/>
     </map:generate>
     <map:transform src="context://stylesheets/system/calendar2html.xslt"/>
-	<!-- to localize the column headers, remove the comments below -->
-	<!--
+    <!-- to localize the column headers, remove the comments below -->
+    <!--
     <map:transform type="i18n">
-       <map:parameter name="locale" value="{request-param:lang}-{request-param:country}"/>
-    </map:transform>
-  	-->
+       <map:parameter name="default-catalogue-id" value="messages"/>
+       <map:parameter name="locale" value="{request-param:lang}"/>
+    </map:transform> 
+    -->
     <map:serialize/>
    </map:match>
 

Modified: cocoon/branches/BRANCH_2_1_X/src/webapp/stylesheets/system/calendar2html.xslt
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/webapp/stylesheets/system/calendar2html.xslt?rev=314854&r1=314853&r2=314854&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/webapp/stylesheets/system/calendar2html.xslt (original)
+++ cocoon/branches/BRANCH_2_1_X/src/webapp/stylesheets/system/calendar2html.xslt Wed Oct 12 04:53:15 2005
@@ -21,7 +21,7 @@
                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
                 xmlns:calendar="http://apache.org/cocoon/calendar/1.0">
-
+        
   <xsl:template match="/">
     <html>
       <head>
@@ -102,12 +102,11 @@
         </p>
         <p>
         <a href="cal?lang=en&amp;country=US">US English</a><br/>
-        <a href="cal?lang=en&amp;country=UK">UK English</a><br/>
+        <a href="cal?lang=en&amp;country=GB">UK English</a><br/>
         <a href="cal?lang=nl">Dutch</a><br/>
         <a href="cal?lang=fr">French</a><br/>
-        <a href="cal?lang=el">Greek</a>
         </p>
-        <p>Note: the column headers and date format are not localized, you can do that by simply inserting the appropriate
+        <p>Note: the column headers are not localized, you can do that by simply inserting the appropriate
           i18n tags and transformer. Check the sample sources (sitemap and XSLT style sheet) and uncomment
           the lines.
         </p>
@@ -127,17 +126,12 @@
           <tr>
             <xsl:for-each select="calendar:week[2]/calendar:day">
               <th>
-                <xsl:if test="@weekday = 'Saturday' or @weekday='Sunday'">
+                <xsl:if test="@weekday = 'SATURDAY' or @weekday='SUNDAY'">
                     <xsl:attribute name="class">weekend</xsl:attribute>
                 </xsl:if>
-                <!-- uncomment the lines below for i18n localization -->
-                <!-- Note that you also need to provide the appropriate message files
-                <i18n:text>
-                -->
-                <xsl:value-of select="@weekday"/>
-                <!--
-                </i18n:text>
-                -->
+                <!-- The lines below provide i18n localization for headers -->
+                <!-- Note that you also need to provide the appropriate message files -->
+                <i18n:text><xsl:value-of select="@weekday"/></i18n:text>
               </th>
             </xsl:for-each>
           </tr>
@@ -175,7 +169,7 @@
       </xsl:if>
       <xsl:for-each select="calendar:day">
         <td>
-          <xsl:if test="@weekday = 'Saturday' or @weekday = 'Sunday'">
+          <xsl:if test="@weekday = 'SATURDAY' or @weekday = 'SUNDAY'">
             <xsl:attribute name="class">weekend</xsl:attribute>
           </xsl:if>
           <div class="daytitle"><xsl:value-of select="@number"/></div>