cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cédric Damioli <cdami...@apache.org>
Subject Re: Trouble switching locales with i18ntransformer
Date Tue, 09 Jan 2018 19:39:11 GMT
Hi Christopher,

Just in case, did you try to hardcode the "es" value :

       <map:transform type="i18n">
         <map:parameter name="locale" value="es" />
       </map:transform>



Regards,
Cédric

Le 09/01/2018 à 17:34, Christopher Schultz a écrit :
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> All,
>
> I have an I18NTranformer configured and <i18n> elements in my
> stylesheets and everything is working for the default locale. But
> changing locales doesn't seem to be working for me. I think I must be
> missing something.
>
> I'm using Cocoon 2.1.11.
>
> Here's what I have:
>
> sitemap.xmap:
>
> <map:components>
>    <map:transformers>
>      <map:transformer name="i18n" ...>
>        <catalogues default="summary">
>          <catalogue id="common" location="/path/to/dir" />
>          <catalogue id="summary" location="/path/to/dir" />
>        </catalogues>
>      </map:transformer>
>   ...
>    </map:transformers>
>
>    <map:pipelines>
>      <map:component-configurations>
>        <global-variables>
>          <i18n-locale>en</i18n-locale>
>          ...
>        </global-variables>
>      </map:component-configurations>
>
>    <map:pipeline>
>      <map:match ...>
>        ...
>        <map:transform type="i18n">
>          <map:parameter name="locale" value="${i18n-locale}" />
>        </map:transform>
>        ...
>      </map:match>
>    </map:pipeline>
> </map:components>
>
> I have 3 files in /path/to/files:
>
> common.xml     [xml:lang="en"]
> summary.xml    [xml:lang="en"]
> summary_es.xml [xml:lang="es"]
>
> This works as expected with <i18n-locale>en</i18n-locale> is set in
> the global-variables section.
>
> I was expecting that changing <i18n-locale> to:
>
>    <i18n-locale>es</i18n-locale>
>
> And then restarting Cocoon would end up using the text from my
> summary_es.xml file, but it's still showing the English text from
> summary.xml.
>
> Replacing summary.xml with summary_es.xml works of course (i.e. the
> text from summary_es.xml is now showing in my rendered pages).
>
> The client (browser) is advertising a preference for lang=en, but that
> shouldn't matter because I'm invoking the i18n transform specifically
> with locale="en", right? I even changed by browser's preferred
> language from English to Spanish and nothing changed.
>
> I'd prefer to be able to change the locale by setting the
> <i18n-locale> global variable and not doing anything else. What am I
> missing, here?
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQJRBAEBCAA7FiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlpU7yMdHGNocmlzQGNo
> cmlzdG9waGVyc2NodWx0ei5uZXQACgkQHPApP6U8pFiDLQ/6A0SqCs/ava78tK53
> CSvMZqpY4xfKXu3GQqS+7DK0wxi4pOcnsNtRxhaQHmPVPvtPKv6H0+fzGIMkRpGn
> lJRcXzSFAa4zkWcQ2zDPh+FatROftroTRK+TljVIrmYJG4BNFbuH1PlNgpj3dPOC
> bpuKhTNAC8lz7Pdu9JbTiy3mCSXihv18S/wcJ52g69Uh8oa5Vo1o6nHDO1hEe1zt
> ejBDVQd5pytmFomWrYm2BR0/OG3mjUY+9uyI3Ys1K8uuFDFxtT6u0Ew0RtpYP9T3
> UdWCvcR1ixmVNQ9Xwxtk8Cf0n0eoYdffdj+LK3h7WdCF/eJCkRkxTzrB2KmFnaiq
> BwHJmXs1u0V5If9POEBsP+GjhdwCtdV2up16yb6f2Mw6X0/fsQvmmVA9eQUk7/EH
> s94qvOkjeozTZVGd8Hovw9GXYze9MMHOp4lVz5H93e0Psjy8BBIOfSyxQEtPx9A9
> xh/POW1BOKDUw1O2/x8f21yHwlOcwfIrkQKRvp9cAFQMWtAsJ7QJVqUX5jdtIsrO
> H/tBO0+qO7HNfxllyHeSVbx+nPkHEXceijUZfhG+Nakmi/GfgMgtangrKbfSflEU
> vl+qRHbHYdBphrIrWRy6huyOQojV4RAxp8WcV8+M9NrtItFIUeDuCnJumH51Fm1Y
> oubhYj1xaPRowGIlWmrAD3tlEIo=
> =NoLl
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>

-- 
Cédric Damioli
CMS - Java - Open Source
www.ametys.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message