cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Xaquin Lores <xaq...@udc.es>
Subject I18n: how to pass locale to xslt
Date Mon, 06 Apr 2009 11:39:03 GMT
Hello,

In a multilingual system I'm trying to pass locale to xsl stylesheet, but
I'm having some problems.
I can pass locale like parameter in url (?locale=en) and then catch it with
  <xsl:param name="locale"/>    and
"locale é <xsl:value-of select="$locale"/>" in the xsl.
But then, if I change page using menus in the application (without passing
parameter) the system retain locale well, but the variable in xsl dont work.
I'm using Cocoon 2.1.9 , Tomcat 5.5 and in the sitemap I have activated
LocaleAction.


        <map:transformer logger="sitemap.transformer.xslt" name="xslt"
pool-max="32"
                src="org.apache.cocoon.transformation.TraxTransformer">
                <use-request-parameters>true</use-request-parameters>
                <use-session-parameters>true</use-session-parameters>
                <use-cookie-parameters>true</use-cookie-parameters>
                <xslt-processor-role>xalan</xslt-processor-role>
                <check-includes>true</check-includes>
            </map:transformer>
            <map:transformer name="i18n"
src="org.apache.cocoon.transformation.I18nTransformer">
                <catalogues default="default">
                    <catalogue id="default" name="messages"
location="context:/i18n"/>
                </catalogues>
                <untranslated-text>untranslated</untranslated-text>
                <cache-at-startup>false</cache-at-startup>
            </map:transformer>


    <map:action name="locale" src="org.apache.cocoon.acting.LocaleAction">
                <locale-attribute>locale</locale-attribute>
                <use-locale>true</use-locale>
                <default-locale language="gl" country="ES"/>
                <store-in-request>true</store-in-request>
                <create-session>true</create-session>
                <store-in-session>true</store-in-session>
                <store-in-cookie>true</store-in-cookie>
            </map:action>

    <map:resource name="i18n-transformer">
            <map:act type="locale">
                <map:transform type="i18n">
                    <map:parameter name="locale" value="{locale}"/>

                </map:transform>
            </map:act>
        </map:resource>

I need to pass locale even in case that in the url there isn't a explicit
parameter.

thanks in advance


Xaquin Lores

Mime
View raw message