svn commit: r1026354 - in /lenya/trunk/org.apache.lenya.core.i18n: ./ src/main/resources/COB-INF/ src/main/resources/COB-INF/resources/ src/main/resources/COB-INF/xslt/ src/main/resources/META-INF/cocoon/avalon/ src/main/resources/META-INF/cocoon/spring/

[email protected] Fri, 22 Oct 2010 14:58:32 -0000
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: florent
Date: Fri Oct 22 14:58:32 2010
New Revision: 1026354

URL: http://svn.apache.org/viewvc?rev=1026354&view=rev
Log:
- definition of the module

Added:
    lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/COB-INF/
    lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/COB-INF/resources/
    lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/COB-INF/sitemap.xmap
    lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/COB-INF/xslt/
    lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/COB-INF/xslt/emptyCatalogue.xml
    lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/COB-INF/xslt/modules2include.xsl
    lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/META-INF/cocoon/spring/
    lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/META-INF/cocoon/spring/lenya-core-i18n-blockServlet.xml
Modified:
    lenya/trunk/org.apache.lenya.core.i18n/pom.xml
    lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/META-INF/cocoon/avalon/lenya-core-i18n-sitemap.xconf

Modified: lenya/trunk/org.apache.lenya.core.i18n/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.i18n/pom.xml?rev=1026354&r1=1026353&r2=1026354&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.i18n/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.core.i18n/pom.xml Fri Oct 22 14:58:32 2010
@@ -14,4 +14,25 @@
   <artifactId>lenya-core-i18n</artifactId>
   <packaging>jar</packaging>
   <name>Apache Lenya Core I18N</name>
+  
+   <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.cocoon</groupId>
+        <artifactId>cocoon-maven-plugin</artifactId>
+        <version>1.0.0-RC1-SNAPSHOT</version>
+        <executions>
+          <execution>
+            <id>rcl</id>
+            <phase>compile</phase>
+            <goals>
+              <goal>rcl</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  
+  
 </project>

Added: lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/COB-INF/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/COB-INF/sitemap.xmap?rev=1026354&view=auto
==============================================================================
--- lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/COB-INF/sitemap.xmap (added)
+++ lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/COB-INF/sitemap.xmap Fri Oct 22 14:58:32 2010
@@ -0,0 +1,97 @@
+<?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 id="service">
+
+    <map:match pattern="translation">
+      <map:generate src="service-consumer:" />
+      <map:transform type="i18n">
+        <map:parameter name="locale" value="{request:locale}" />
+      </map:transform>
+      <map:serialize type="xml" />
+
+    </map:match>
+
+  </map:pipeline>
+    
+    <map:pipeline type="noncaching">
+      
+      <!-- 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="resource-exists">
+          <map:when test="context://lenya/resources/i18n/{1}">
+            <map:select type="parameter">
+              <map:parameter name="parameter-selector-test" value="{page-envelope:is-publication}"/>
+              <map:when test="true">
+                <map:generate src="cocoon:/pubCatalogue/{page-envelope:publication-id}/{1}"/>
+              </map:when>
+              <map:otherwise>
+                <map:generate src="context://lenya/resources/i18n/{1}"/>
+              </map:otherwise>
+            </map:select>
+            <map:serialize type="xml"/>
+          </map:when>
+        </map:select>
+      </map:match>
+      
+      <!-- This pipeline generates the catalogue for each publication. The result is cached. -->
+      <!-- {1:pub}/{2:catalogue} -->
+      <map:match pattern="pubCatalogue/*/*">
+        <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>
+      
+      <!-- Generate module i18n catalogues. We use the selector instead of direct inclusion
+        because otherwise the result wouldn't be cached when catalogues are missing. -->
+      <!-- modules/{1:module}/{2:catalogue} -->
+      <map:match pattern="modules/*/*">
+        <map:select type="resource-exists">
+          <map:when test="aggregate-fallback://lenya/modules/{1}/resources/i18n/{2}">
+            <map:generate src="aggregate-fallback://lenya/modules/{1}/resources/i18n/{2}"/>
+            <map:serialize type="xml"/>
+          </map:when>
+          <map:otherwise>
+            <map:generate src="xslt/emptyCatalogue.xml"/>
+            <map:serialize type="xml"/>
+          </map:otherwise>
+        </map:select>
+      </map:match>
+      
+    </map:pipeline>  
+  </map:pipelines>
+  
+</map:sitemap>

Added: lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/COB-INF/xslt/emptyCatalogue.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/COB-INF/xslt/emptyCatalogue.xml?rev=1026354&view=auto
==============================================================================
--- lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/COB-INF/xslt/emptyCatalogue.xml (added)
+++ lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/COB-INF/xslt/emptyCatalogue.xml Fri Oct 22 14:58:32 2010
@@ -0,0 +1,21 @@
+<?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.
+-->
+
+<catalogue xmlns="http://apache.org/cocoon/i18n/2.1"/>
+
+

Added: lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/COB-INF/xslt/modules2include.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/COB-INF/xslt/modules2include.xsl?rev=1026354&view=auto
==============================================================================
--- lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/COB-INF/xslt/modules2include.xsl (added)
+++ lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/COB-INF/xslt/modules2include.xsl Fri Oct 22 14:58:32 2010
@@ -0,0 +1,44 @@
+<?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"/>
+      <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="cocoon:/modules/{@name}/{$catalogue}" strip-root="true"/>
+    </xsl:if>
+  </xsl:template>
+
+</xsl:stylesheet>

Modified: lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/META-INF/cocoon/avalon/lenya-core-i18n-sitemap.xconf
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/META-INF/cocoon/avalon/lenya-core-i18n-sitemap.xconf?rev=1026354&r1=1026353&r2=1026354&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/META-INF/cocoon/avalon/lenya-core-i18n-sitemap.xconf (original)
+++ lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/META-INF/cocoon/avalon/lenya-core-i18n-sitemap.xconf Fri Oct 22 14:58:32 2010
@@ -16,11 +16,12 @@
   limitations under the License.
 -->
 
+<!-- <catalogue id="cmsui" name="cmsui" location="cocoon://modules/i18n/catalogue/"/> -->
 <map:components xmlns:map="http://apache.org/cocoon/sitemap/1.0">
   <map:transformers>
     <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/"/>
+        <catalogue id="cmsui" name="cmsui" location="resources/i18n"/>
       </catalogues>
       <untranslated-text>untranslated</untranslated-text>
       <cache-at-startup>true</cache-at-startup>

Added: lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/META-INF/cocoon/spring/lenya-core-i18n-blockServlet.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/META-INF/cocoon/spring/lenya-core-i18n-blockServlet.xml?rev=1026354&view=auto
==============================================================================
--- lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/META-INF/cocoon/spring/lenya-core-i18n-blockServlet.xml (added)
+++ lenya/trunk/org.apache.lenya.core.i18n/src/main/resources/META-INF/cocoon/spring/lenya-core-i18n-blockServlet.xml Fri Oct 22 14:58:32 2010
@@ -0,0 +1,31 @@
+<?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
+  und
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:servlet="http://cocoon.apache.org/schema/servlet"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+                           http://cocoon.apache.org/schema/servlet http://cocoon.apache.org/schema/servlet/cocoon-servlet-1.0.xsd">
+
+  <bean name="org.apache.lenya.core.i18n.block" class="org.apache.cocoon.sitemap.SitemapServlet">
+    <servlet:context mount-path="/i18n" context-path="blockcontext:/lenya-core-i18n-2.2.0-SNAPSHOT/">
+    </servlet:context>
+  </bean>
+</beans>