solve some i18n issues
git-svn-id: https://svn.apache.org/repos/asf/lenya/trunk@1033154 13f79535-47bb-0310-9956-ffa450edef68
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
index f70bc49..2368fb5 100644
--- 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
@@ -24,10 +24,9 @@
in sitemap.xmap and global-sitemap.xmap.
-->
-<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
-
- <map:pipelines>
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+ <map:pipelines>
<map:pipeline id="service">
<map:match pattern="translation">
@@ -42,13 +41,13 @@
</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:when test="fallback://lenya/resources/i18n/{1}">
<map:select type="parameter">
<map:parameter name="parameter-selector-test" value="{page-envelope:is-publication}"/>
<map:when test="true">
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
index bd29443..e9e2532 100644
--- 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
@@ -16,6 +16,13 @@
limitations under the License.
-->
-<catalogue xmlns="http://apache.org/cocoon/i18n/2.1"/>
+<catalogue xmlns="http://apache.org/cocoon/i18n/2.1">
+ <!-- add this message because the directive
+ <i:include src="path/file" strip-root="true" /> throw an error if the file is just composed by root
+ TODO : solve this bug in the cocoon include transformer and clean this workaround here
+ -->
+ <message key="empty.catalogue">Empty Catalogue</message>
+
+</catalogue>
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 8ebdef3..094ac58 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,14 +16,43 @@
limitations under the License.
-->
-<!-- <catalogue id="cmsui" name="cmsui" location="cocoon://modules/i18n/catalogue/"/> -->
+<!-- TODO : use the "dynamic" catalogue pipeline ie with this catalogue definition (that refer to a pipeline in this sitemap) :
+ <catalogue id="cmsui" name="cmsui" location="servlet:i18n:/catalogue/" />
+
+ There is a strange behaviour : when the i18n transformer is use in this context
+ <map:match pattern="thatworks">
+ <map:generate src="alocalFile.xml"/>
+ <map:transform type="i18n"/>
+ <map:serialize type="xml"/>
+ </map:match>
+
+ This works
+
+ But this don't works when used in this context :
+ <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>
+
+
+ I also try <catalogue id="cmsui" name="cmsui" location="servlet:i18n:/catalogue" />
+ with no success...
+
+
+-->
<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="resources/i18n"/>
+ <catalogue id="cmsui" name="cmsui" location="resources/i18n" />
+ <!-- this under seems to not work too... and this is not a good approch because all module have to be referenced here -->
+ <catalogue id="export-module" name="cmsui" location="fallback://lenya/modules/export/resources/i18n" />
</catalogues>
- <untranslated-text>untranslated</untranslated-text>
+ <!-- commented while translation not solve
+ <untranslated-text>untranslated</untranslated-text> -->
<cache-at-startup>true</cache-at-startup>
</map:transformer>
</map:transformers>
diff --git a/org.apache.lenya.core.i18n/src/main/resources/META-INF/cocoon/spring/lenya-core-i18n-module-registration.xml b/org.apache.lenya.core.i18n/src/main/resources/META-INF/cocoon/spring/lenya-core-i18n-module-registration.xml
new file mode 100644
index 0000000..ed2efdc
--- /dev/null
+++ b/org.apache.lenya.core.i18n/src/main/resources/META-INF/cocoon/spring/lenya-core-i18n-module-registration.xml
@@ -0,0 +1,30 @@
+<?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.
+-->
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:p="http://www.springframework.org/schema/p"
+ xmlns:configurator="http://cocoon.apache.org/schema/configurator"
+ xmlns="http://www.springframework.org/schema/beans"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://cocoon.apache.org/schema/configurator http://cocoon.apache.org/schema/configurator/cocoon-configurator-1.0.1.xsd">
+
+ <bean name="org.apache.lenya.cms.module.Module/i18n"
+ class="org.apache.lenya.cms.module.ModuleImpl">
+ <property name="baseUri" value="file://${lenya.home}/org.apache.lenya.core.i18n/target/classes/COB-INF"/>
+ </bean>
+
+</beans>