forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From che...@apache.org
Subject svn commit: rev 9635 - in xml/forrest/trunk: . src/core/context src/core/context/resources/stylesheets src/core/fresh-site/src/documentation/translations
Date Fri, 19 Mar 2004 21:09:11 GMT
Author: cheche
Date: Fri Mar 19 13:09:10 2004
New Revision: 9635

Added:
   xml/forrest/trunk/src/core/context/i18n.xmap
   xml/forrest/trunk/src/core/context/resources/stylesheets/directory2i18n.xsl
   xml/forrest/trunk/src/core/fresh-site/src/documentation/translations/languages_en.xml
   xml/forrest/trunk/src/core/fresh-site/src/documentation/translations/languages_es.xml
Modified:
   xml/forrest/trunk/src/core/context/sitemap.xmap
   xml/forrest/trunk/status.xml
Log:
Add language alternative code. To Test it:
i18-index.html


Added: xml/forrest/trunk/src/core/context/i18n.xmap
==============================================================================
--- (empty file)
+++ xml/forrest/trunk/src/core/context/i18n.xmap	Fri Mar 19 13:09:10 2004
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2002-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.
+-->
+<!--
+Allows to create a language menu so it can be
+-->
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+  <map:components>
+    <map:generators>
+      <map:generator name="directory" src="org.apache.cocoon.generation.DirectoryGenerator"
/>
+    </map:generators>
+    <map:serializers default="html"/>
+    <map:matchers default="wildcard"/>
+    <map:transformers default="xslt">
+      <map:transformer name="i18n" src="org.apache.cocoon.transformation.I18nTransformer">
+        <catalogues default="languages">
+          <catalogue id="languages" name="languages" location="{project:translations}"/>
+        </catalogues>
+      </map:transformer>
+    </map:transformers>
+    <map:actions>
+      <map:action name="locale" src="org.apache.cocoon.acting.LocaleAction" />
+    </map:actions>
+  </map:components> 
+
+  <map:pipelines>
+    <map:pipeline>
+      <map:act type="locale" >
+      <map:match pattern="**i18n-*.*">
+      <map:generate type="directory" src="{project:content.xdocs}{1}">
+        <map:parameter name="dateFormat" value="yyyy-MM-dd hh:mm" />
+        <map:parameter name="include" value="^{2}" />
+        <map:parameter name="exclude" value="^{2}\.|{2}_{../lang}" />
+      </map:generate>
+      <map:transform src="{forrest:stylesheets}/directory2i18n.xsl">
+        <map:parameter name="ext"    value="{3}" />
+      </map:transform>
+      <map:transform type="i18n">
+        <map:parameter name="locale" value="{../lang}"/>
+      </map:transform>
+      <map:serialize type="xml"/>
+      </map:match>
+      </map:act>
+    </map:pipeline>
+  </map:pipelines>
+</map:sitemap>

Added: xml/forrest/trunk/src/core/context/resources/stylesheets/directory2i18n.xsl
==============================================================================
--- (empty file)
+++ xml/forrest/trunk/src/core/context/resources/stylesheets/directory2i18n.xsl	Fri Mar 19
13:09:10 2004
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2002-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.
+-->
+
+<xsl:stylesheet exclude-result-prefixes="dir" version="1.0"
+    xmlns:dir="http://apache.org/cocoon/directory/2.0" 
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+
+    <xsl:param name="ext" />
+
+    <xsl:template match="/">
+        <div class="lang" >
+            <xsl:apply-templates/>
+        </div>
+    </xsl:template>
+    <xsl:template match="dir:file">
+     <xsl:element name="a">
+       <xsl:attribute name="href">
+         <xsl:value-of select="concat(substring-before(@name,'.'),'.',$ext)"/>
+       </xsl:attribute >
+       <xsl:attribute name="hreflang">
+         <xsl:value-of select="substring-after(substring-before(@name, '.'),'_')"/>
+       </xsl:attribute >
+     <xsl:element name="i18n:text">
+         <xsl:value-of select="substring-after(substring-before(@name, '.'),'_')"/>
+     </xsl:element>
+     </xsl:element>
+    </xsl:template>
+</xsl:stylesheet>

Modified: xml/forrest/trunk/src/core/context/sitemap.xmap
==============================================================================
--- xml/forrest/trunk/src/core/context/sitemap.xmap	(original)
+++ xml/forrest/trunk/src/core/context/sitemap.xmap	Fri Mar 19 13:09:10 2004
@@ -340,6 +340,10 @@
       <map:match pattern="**tab-*.html">
         <map:mount uri-prefix="" src="tabs.xmap" check-reload="yes" />
       </map:match>
+      
+      <map:match pattern="**i18n-*.html">
+        <map:mount uri-prefix="" src="i18n.xmap" check-reload="yes" />
+      </map:match>
 
       <map:match pattern="**book-*.html">
         <map:mount uri-prefix="" src="menu.xmap" check-reload="yes" />

Added: xml/forrest/trunk/src/core/fresh-site/src/documentation/translations/languages_en.xml
==============================================================================
--- (empty file)
+++ xml/forrest/trunk/src/core/fresh-site/src/documentation/translations/languages_en.xml
Fri Mar 19 13:09:10 2004
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2002-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.
+-->
+<catalogue xml:lang="en">
+  <message key="en">English</message>
+  <message key="es">Spanish</message>
+  <message key="nl">Dutch</message>
+</catalogue>

Added: xml/forrest/trunk/src/core/fresh-site/src/documentation/translations/languages_es.xml
==============================================================================
--- (empty file)
+++ xml/forrest/trunk/src/core/fresh-site/src/documentation/translations/languages_es.xml
Fri Mar 19 13:09:10 2004
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2002-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.
+-->
+<catalogue xml:lang="es">
+  <message key="en">Ingles</message>
+  <message key="es">Espanol</message>
+  <message key="nl">Holandes</message>
+</catalogue>

Modified: xml/forrest/trunk/status.xml
==============================================================================
--- xml/forrest/trunk/status.xml	(original)
+++ xml/forrest/trunk/status.xml	Fri Mar 19 13:09:10 2004
@@ -44,6 +44,10 @@
 
   <changes>
     <release version="0.6-dev" date="unreleased">
+      <action dev="JJP" type="add" context="core" >
+        Add Language alternativates div. To test it:
+        i18n-foo.html
+      </action>
       <action dev="JJP" type="add" context="core" 
         due-to="Florian G. Haas" fixes-bug="FOR-112">
         Page size and orientation for pdf.

Mime
View raw message