Hi everybody,
Thanks to Ard, I am able to provide a fix for the I18nTransformer.
THE PROBLEM
My problem was that I am using a session to track the user locale and a
caching pipeline. I am using the LocaleAction to intercept the locale
value via the module session-attr :
<map:act type = "locale">
<map:match pattern = "test.html">
<map:generate src = "test.html"/>
<map:transform type = "i18n">
<map:parameter name = "locale" value = "{session-attr:locale}"/>
</map:transform>
<map:serialize type = "html"/>
</map:match>
</map:act>
NOTE
Without caching(<map:pipeline type='caching'>...</map:pipeline>) the
problem doesn't occur but the performance is poor.
THE SOLUTION
The issue with the i18ntransformer is that generated cache keys are not
unique. A simple solution which might not be the best is:
package org.fix.cocoon.transformation;
import java.io.Serializable;
import org.apache.cocoon.environment.*;
import org.apache.cocoon.transformation.I18nTransformer;
/**
*
* @author Yves Zoundi
*/
public class I18nTransformerFix extends I18nTransformer {
public Serializable getKey() {
StringBuffer buff = new StringBuffer();
buff.append("" + System.currentTimeMillis());
buff.append("_");
buff.append(super.getKey());
return buff.toString();
}
}
It would be good to have a I18nSessionEnabledTransformer so that the cache
keys are always associated to the session. This would also prevent the
i18ntransformer to generate a huge amount of keys.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]