[opencms-dev] Frontend/Website Localization

Rüdiger Kurz r.kurz at alkacon.com
Thu Nov 14 17:18:36 CET 2013


Try to print out: ${cms.locale} and check if it is set to the right locale.

My assumption is that ${cms} which is an instance of 
org.opencms.jsp.util.CmsJspStandardContextBean is not initialized in the 
main tamplate (a formatter initialized this by using  the 
<cms:formatter> tag).

So try:
<c:set var="locale"><cms:info property="opencms.request.locale"/></c:set>
<fmt:setLocale value="${locale}" />


Am 14.11.2013 16:24, schrieb Thorsten Duhn:
> Hello,
>
> thank you, that <cms:bundle /> did the trick - almost. I'm still facing
> some strange problems, but I see progress. Maybe you have an idea on
> this: Now what I see is that messages in main.jsp are always English
> while messages in an included element jsp reflect the locale, which is
> defined on the root folder (I created them also called 'de' and 'en').
> cms.locale also reflects this setting. Just messages come from English
> bundle instead of German (on English page they're also the English
> ones). Publishing, re-initializing is no help - but logghing of is, or
> looking at the online site.
>
> Thanks,
> Thorsten
>
>> Hi,
>>
>> version 9 introduces a new resource type: xmlvfsbundle that offers the
>> capability to edit message keys using the XML content editor. More over
>> those messages will be available at runtime (compared with Java property
>> files this is a real benefit).
>>
>> In order to use those bundles in JSPs, you have use <cms:bundle>-Tag
>> instead of <fmt:bundle>-Tag. Here a code snippet:
>>
>> [...]
>> <fmt:setLocale value="${cms.locale}" />
>> <cms:bundle basename="com.alkacon.bootstrap.schemas.blog">
>> [...]
>>      <fmt:message key="bootstrap.blog.message.readmore" />
>> [...]
>> </cms:bundle>
>> [...]
>>
>> HTH
>> Rüdiger
>>
>> -------------------
>>
>> Rüdiger Kurz
>>
>> Alkacon Software GmbH  - The OpenCms Experts
>> http://www.alkacon.com - http://www.opencms.org
>>
>> Am 14.11.2013 11:08, schrieb Thorsten Duhn:
>>> Hello,
>>>
>>> as the "Frontend/Website Localization" chapter is still empty in 9.0.0
>>> documentation and I cannot see how it works just on looking at bootstrap
>>> example (and cannot find another information source). I would like to
>>> ask if someone may explain it to me. Is there a way to use "XML Resource
>>> Bundle" to store translations for use in template files? How to name,
>>> where to store, how to use? If not, what is the intended way to store
>>> translations and are steps like reinitialisation of workspace still in
>>> need after updates or additions in bundles?
>>>
>>> In my template module I created and filled
>>> "\{my.template}\i18n\{my.template}.messages"
>>> and in my main.jsp I use
>>> <fmt:setLocale value="${cms.locale}" />
>>> and then stuff like
>>> <fmt:message key="my.template.title" />
>>>
>>> All I get is "???my.template.title???".
>>>
>>> Do I need to add some configuration somewhere?
>>>
>>> Regards,
>>> Thorsten
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>
>
>

-- 
Rüdiger Kurz

-------------------

Alkacon Software GmbH - The OpenCms Experts
Rüdiger Kurz
An der Wachsfabrik 13
50996 Koeln, DE

Tel: +49 (0)2236 3826-16
Fax: +49 (0)2236 3826-20
Email: r.kurz at alkacon.com

http://www.alkacon.com
http://www.opencms.org

Geschäftsführer: Alexander Kandzior, Amtsgericht Köln, HRB 54613



More information about the opencms-dev mailing list