cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yves Zoundi <>
Subject RE: [FIX] I18nTransformer [CACHING PIPELINE]
Date Tue, 12 Sep 2006 00:40:28 GMT
Hi everybody,

   There is really a bug with the i18ntransformer! If you thing I'm doing
something wrong with the code below please help!

My test scenario
   I used an unmodified build of cocoon, no custom exclusions of some
blocs. I checked again my code based on the samples : copy and paste.
Guess wwhat? It doesn't work! I am pretty sure about my code, nothing
special straight from the samples. 
   I modified the welcome.xml file to include some i18n:text and I created
a test.html file with some i18n keys. I used the configuration from the
i18n samples and I believe there is a bug with the i18ntransformer. 
   I only used the root sitemap.xmap.

* Here are the relevant parts of the sitemap.xmap
 <map:transformer name="i18n" logger="sitemap.transformer.i18n"
 <catalogues default="messages">
   <catalogue id="messages" name="messages" location="translations"/>
          <catalogue id="menu" name="menu" location="translations"/>
          <catalogue id="tiered" name="messages">
 <map:action name="locale" logger="sitemap.action.locale"
        <!-- Creates a new session if needed. Used with 'store-in-session'
param -->
        <!-- Stores locale information in session. A session should be
created before, 
             otherwise 'create-session' should be true.
        <!-- Stores locale information in request attributes -->
        <!-- Stores locale information in a client cookie -->
      <default-locale language="en" country="US"/>

 <!-- main pipeline -->
  <map:pipeline type = "caching">
   <map:act type = "locale">    
    <map:match pattern = "index.html">
	<map:redirect-to uri = ""/>
    <map:match pattern = "status.html">
       <map:generate type = "status"/>
       <map:transform src = "stylesheets/system/status2html.xslt"/>
       <map:serialize type = "html"/>    
    <map:match pattern = "test.html">
	<map:generate src = "test.html"/>
	 <map:transform type = "i18n">
	 <map:parameter name="locale" value="{../locale}"/>
      <map:serialize type = "html"/>
    <!-- welcome page -->
    <map:match pattern="">
      <map:generate src="welcome.xml"/>      
      <map:transform type = "i18n">		 
	 <map:parameter name="locale" value="{../locale}"/>
      <map:transform src="welcome.xslt">
        <map:parameter name="contextPath" value="{request:contextPath}"/>
      <map:serialize type="xhtml"/>


Here are the original welcome.xml(customized) and test.html files
<?xml version="1.0" encoding="UTF-8"?><!--
<welcome xmlns:i18n="">
 <p><a href = "test.html">test</a></p>
   Congratulations! If you are reading this page, it means that
   your Apache Cocoon installation was successful.
  <message id="samples">
   To know more about Cocoon capabilities, look at the <link

* test.html
<html xmlns:i18n="">
 <p><a href = "index.html">home</a></p>

* messages_en_US.xml
<catalogue xml:lang="en_US">
 <message key="anglais">english</message>
 <message key="francais">french</message>  

* messages_fr_FR.xml
<catalogue xml:lang="fr_FR">
 <message key="anglais">anglais</message>
 <message key="francais">francais</message>  

* messages.xml
<catalogue xml:lang="fr_FR">
 <message key="anglais">anglais</message>
 <message key="francais">francais</message>  

The catalogs are simple with only 2 keys.

I am switching the languages by manually appending a request parameter
?locale=fr_FR or ?locale=en_US to the current URL. Sometimes when I
navigate between index.html and test.html, I see that the locale is not
updated, Cocoon is serving the cache without analysing the session locale.
I tried using the session-attribute generator to see if the locale was
updated and It is. The cocoon status shows me that the catalog are in the
cache and the cache keys of the pages(i18ntransformer cache keys) seem all
right. The keys seem unique for a request.

Thanks in advance.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message