You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2008/02/08 01:19:02 UTC

svn commit: r619696 - in /lenya/trunk/src/modules-core/i18n: ./ config/ config/module.xml config/sitemap/ config/sitemap/i18n-transformer.xmap sitemap.xmap xslt/ xslt/modules2include.xsl

Author: andreas
Date: Thu Feb  7 16:19:00 2008
New Revision: 619696

URL: http://svn.apache.org/viewvc?rev=619696&view=rev
Log:
Adding i18n handling module

Added:
    lenya/trunk/src/modules-core/i18n/
    lenya/trunk/src/modules-core/i18n/config/
    lenya/trunk/src/modules-core/i18n/config/module.xml
    lenya/trunk/src/modules-core/i18n/config/sitemap/
    lenya/trunk/src/modules-core/i18n/config/sitemap/i18n-transformer.xmap
    lenya/trunk/src/modules-core/i18n/sitemap.xmap
    lenya/trunk/src/modules-core/i18n/xslt/
    lenya/trunk/src/modules-core/i18n/xslt/modules2include.xsl

Added: lenya/trunk/src/modules-core/i18n/config/module.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/i18n/config/module.xml?rev=619696&view=auto
==============================================================================
--- lenya/trunk/src/modules-core/i18n/config/module.xml (added)
+++ lenya/trunk/src/modules-core/i18n/config/module.xml Thu Feb  7 16:19:00 2008
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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.
+-->
+
+<!-- $Id: publication.xml 374687 2006-02-03 15:24:55Z michi $ -->
+
+<module xmlns="http://apache.org/lenya/module/1.0">
+  <id>org.apache.lenya.modules.i18n</id>
+  <package>org.apache.lenya.modules</package>
+  <version>0.1-dev</version>
+  <name>I18n</name>
+  <lenya-version>@lenya.version@</lenya-version>
+  <description>Internationalization handling</description>
+</module>

Added: lenya/trunk/src/modules-core/i18n/config/sitemap/i18n-transformer.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/i18n/config/sitemap/i18n-transformer.xmap?rev=619696&view=auto
==============================================================================
--- lenya/trunk/src/modules-core/i18n/config/sitemap/i18n-transformer.xmap (added)
+++ lenya/trunk/src/modules-core/i18n/config/sitemap/i18n-transformer.xmap Thu Feb  7 16:19:00 2008
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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.
+-->
+
+<xmap xpath="/sitemap/components/transformers" 
+  unless="/sitemap/components/transformers/transformer[@name = 'i18n']"
+  xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+  
+    <map:transformer name="i18n" logger="sitemap.transformer.i18n" src="org.apache.cocoon.transformation.I18nTransformer">
+      <catalogues default="cmsui">
+         <catalogue id="cmsui" name="cmsui" location="cocoon://modules/i18n/catalogue/"/>
+       </catalogues>
+       <untranslated-text>untranslated</untranslated-text>
+       <cache-at-startup>true</cache-at-startup>
+    </map:transformer>
+</xmap>

Added: lenya/trunk/src/modules-core/i18n/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/i18n/sitemap.xmap?rev=619696&view=auto
==============================================================================
--- lenya/trunk/src/modules-core/i18n/sitemap.xmap (added)
+++ lenya/trunk/src/modules-core/i18n/sitemap.xmap Thu Feb  7 16:19:00 2008
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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.
+-->
+
+<!-- $Id: i18n.xmap 595134 2007-11-14 23:35:21Z andreas $ -->
+
+<!--
+  This sitemaps provides fallback message catalogues and catalogue merging.
+  The reason for the existence of this sitemap is mainly to avoid endless loops caused by mounts
+  in sitemap.xmap and global-sitemap.xmap.
+-->
+
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+  
+  <map:pipelines>
+    
+    <map:pipeline type="caching">
+      
+      <!-- This pipeline is decoupled from the one below because the page-envelope input module
+        call prevents it from being cached. -->
+      <!-- catalogue/{1:catalogue} -->
+      <map:match pattern="catalogue/*">
+        <map:select type="parameter">
+          <map:parameter name="parameter-selector-test" value="{page-envelope:is-publication}"/>
+          <map:when test="true">
+            <map:generate src="cocoon:/{page-envelope:publication-id}/{1}"/>
+          </map:when>
+          <map:otherwise>
+            <map:generate src="fallback://lenya/resources/i18n/{1}"/>
+          </map:otherwise>
+        </map:select>
+        <map:serialize type="xml"/>
+      </map:match>
+      
+      <!-- This pipeline generates the catalogue for each publication. The result is cached. -->
+      <!-- {1:pub}/{2:catalogue} -->
+      <map:match pattern="*/*">
+        <map:generate src="aggregate-fallback://config/publication.xml"/>
+        <map:transform src="xslt/modules2include.xsl">
+          <map:parameter name="pub" value="{1}"/>
+          <map:parameter name="catalogue" value="{2}"/>
+        </map:transform>
+        <map:transform type="include"/>
+        <map:serialize type="xml"/>
+      </map:match>
+      
+    </map:pipeline>  
+  </map:pipelines>
+  
+</map:sitemap>

Added: lenya/trunk/src/modules-core/i18n/xslt/modules2include.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/i18n/xslt/modules2include.xsl?rev=619696&view=auto
==============================================================================
--- lenya/trunk/src/modules-core/i18n/xslt/modules2include.xsl (added)
+++ lenya/trunk/src/modules-core/i18n/xslt/modules2include.xsl Thu Feb  7 16:19:00 2008
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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.
+-->
+
+<!-- $Id: xinclude.xsl 123414 2004-12-27 14:52:24Z gregor $ -->
+
+<xsl:stylesheet version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:i="http://apache.org/cocoon/include/1.0"
+  xmlns:lenya="http://apache.org/cocoon/lenya/publication/1.1"
+  xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+  exclude-result-prefixes="lenya">
+
+  <xsl:param name="catalogue"/>
+  <xsl:param name="pub"/>
+  
+  <xsl:template match="lenya:publication">
+    <i18n:catalogue>
+      <i:include src="aggregate-fallback://lenya/resources/i18n/{$catalogue}" strip-root="true">
+        <i:fallback/>
+      </i:include>
+      <xsl:apply-templates select="lenya:modules/lenya:module"/>
+    </i18n:catalogue>
+  </xsl:template>
+  
+  <xsl:template match="lenya:module">
+    <xsl:if test="not(preceding-sibling::lenya:module[@name = current()/@name])">
+      <i:include src="aggregate-fallback://lenya/modules/{@name}/resources/i18n/{$catalogue}" strip-root="true">
+        <i:fallback/>
+      </i:include>
+    </xsl:if>
+  </xsl:template>
+
+</xsl:stylesheet>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org