cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Trouble switching locales with i18ntransformer
Date Tue, 09 Jan 2018 16:54:45 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

All,

On 1/9/18 11:34 AM, Christopher Schultz wrote:
> 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?

Another data point:

I decided to remove the "default" locale, like this:

$ cd /path/to/dir
$ mv summary.xml summary_en.xml
$ mv common.xml common_en.xml
$ ls
common_en.xml   summary_en.xml    summary_es.xml

[i18n-locale in sitemap is still set to "es" (Spanish)]
[bounce Cocoon, reload page]

Now, the page shows "untranslated" (which is my <untranslated-text>
value) for everything.

So it seems that Cocoon is not picking-up my non-default localized
files at all; it's only using [catalogue.xml] and not the
locale-specific ones.

Any suggestions?

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQJRBAEBCAA7FiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlpU89UdHGNocmlzQGNo
cmlzdG9waGVyc2NodWx0ei5uZXQACgkQHPApP6U8pFgyOA//cEGu5N7AudHdNSV9
L6pvhBRjoHcWtukUmnNqv7F57fztelEj7eI3WRNeBFbV8f5xS2sJZd/dJI28eGzR
6VHXJwHXQWv5RT4KKAEhw/esI2CduncwMrpf+ZZvD5YiA4qYT/Jqnte/ove4O/6s
hbZJ6a+qvaedVVOMNVCUrrNcgslJHcMAXzzZYtDU9r4EMKgn7ZOWM1uFmBYliSlT
k80KZS+0czjZ/0VzWGATAXX7z7lqAL5DLwX+A8aReCDl4rWAtR21Gl4nUKX2Gfc0
mwQX0SFp4Uh0vBtmjIUezK0S4adCFG/d5vzVCA5goHaJxkctNkqt6VEWuge2MbTK
0INeVpfql6g8bKA3kKxTIqioUwbbcPKxtv1RrjCUqTPSJqY/I6HHhDnNJHvodmmJ
p+7pp0kLqoTwWC0uahuzqwN95HwHfnknjcCcTrmisJ3mK9hNV66owRVfyb9EI342
PGHCCimpTXfENGsw+biI+bpo08XQHEohiylSKfsnMRUYU75EhZjtedy0PXKpv6mF
wWzmfCL2y1DKrZPUB7ukL7JZ7M5CqETa2x2adolwu/oT+xeDY5QfBzNFy144OsEP
0tLH9JpVuQWQH2Fk6+Dw/71Z4fQqiU6vP/L5bLc2qVmkgKl1udNPsJ/Ffb6nAZEU
BsUkDSw/nRgRbDpBtc6T2Lo+VM0=
=7YqD
-----END PGP SIGNATURE-----

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


Mime
View raw message