- definition of the module
git-svn-id: https://svn.apache.org/repos/asf/lenya/trunk@1026354 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/org.apache.lenya.core.i18n/pom.xml b/org.apache.lenya.core.i18n/pom.xml
index f5109df..47e8fce 100644
--- a/org.apache.lenya.core.i18n/pom.xml
+++ b/org.apache.lenya.core.i18n/pom.xml
@@ -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>
diff --git a/org.apache.lenya.core.i18n/src/main/resources/COB-INF/sitemap.xmap b/org.apache.lenya.core.i18n/src/main/resources/COB-INF/sitemap.xmap
new file mode 100644
index 0000000..f70bc49
--- /dev/null
+++ b/org.apache.lenya.core.i18n/src/main/resources/COB-INF/sitemap.xmap
@@ -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>
diff --git a/org.apache.lenya.core.i18n/src/main/resources/COB-INF/xslt/emptyCatalogue.xml b/org.apache.lenya.core.i18n/src/main/resources/COB-INF/xslt/emptyCatalogue.xml
new file mode 100644
index 0000000..bd29443
--- /dev/null
+++ b/org.apache.lenya.core.i18n/src/main/resources/COB-INF/xslt/emptyCatalogue.xml
@@ -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"/>
+
+
diff --git a/org.apache.lenya.core.i18n/src/main/resources/COB-INF/xslt/modules2include.xsl b/org.apache.lenya.core.i18n/src/main/resources/COB-INF/xslt/modules2include.xsl
new file mode 100644
index 0000000..eb9fa09
--- /dev/null
+++ b/org.apache.lenya.core.i18n/src/main/resources/COB-INF/xslt/modules2include.xsl
@@ -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>
diff --git a/org.apache.lenya.core.i18n/src/main/resources/META-INF/cocoon/avalon/lenya-core-i18n-sitemap.xconf b/org.apache.lenya.core.i18n/src/main/resources/META-INF/cocoon/avalon/lenya-core-i18n-sitemap.xconf
index 1b64681..8ebdef3 100644
--- a/org.apache.lenya.core.i18n/src/main/resources/META-INF/cocoon/avalon/lenya-core-i18n-sitemap.xconf
+++ b/org.apache.lenya.core.i18n/src/main/resources/META-INF/cocoon/avalon/lenya-core-i18n-sitemap.xconf
@@ -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>
diff --git a/org.apache.lenya.core.i18n/src/main/resources/META-INF/cocoon/spring/lenya-core-i18n-blockServlet.xml b/org.apache.lenya.core.i18n/src/main/resources/META-INF/cocoon/spring/lenya-core-i18n-blockServlet.xml
new file mode 100644
index 0000000..6748360
--- /dev/null
+++ b/org.apache.lenya.core.i18n/src/main/resources/META-INF/cocoon/spring/lenya-core-i18n-blockServlet.xml
@@ -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>