[opencms-dev] Different i18n management

Jorge González informatico at hotelparadisepark.com
Fri Sep 22 17:34:29 CEST 2006


Thank you !

It works, here is my test jsp code snippet...

jsp-jsp-jsp-jsp-jsp-jsp-jsp-jsp-jsp-jsp-jsp-jsp-jsp-jsp-jsp-jsp-

<%@page import="org.opencms.jsp.*, org.opencms.file.*, 
org.opencms.flex.*, java.util.*" %>

<%@ taglib prefix="cmstag" uri="http://www.opencms.org/taglib/cms" %>

<%
  org.opencms.i18n.CmsResourceBundleLoader.flushBundleCache();
  java.util.ResourceBundle messages = 
org.opencms.i18n.CmsResourceBundleLoader.getBundle("your_bundle_here", 
new java.util.Locale("es"));
%>


<%= messages.getString("test.label1") %>

jsp-jsp-jsp-jsp-jsp-jsp-jsp-jsp-jsp-jsp-jsp-jsp-jsp-jsp-jsp-jsp-

Note: You can flush your keys with 
org.opencms.i18n.CmsResourceBundleLoader.flushBundleCache();
Note2: You will get an exception if the key is not found in that bundle, 
this is not a problem, just add the key and flush before hit the jsp 
again !!
Note3: For intense i18ned projects, it could be very useful to have a 
bundle editor, so you can see the tags not translated, etc.


Alexander Kandzior escribió:
> Actually we have implemented such a feature in OpenCms 6.2.
>
> All OpenCms module based message bundles are flushed if you clear the cache,
> which can be triggered by "Administration View >  Workplace Tools >
> Re-Initialize the Workplace". 
>
> You can also use this caching behaviour in your Java code like this:
>
> org.opencms.i18n.CmsResourceBundleLoader.getBundle(baseName, locale);
>
> which is the same as 
>
> java.util.resourceBundle.getBundle(baseName, locale);
>
> only that we do have the flushable bundle cache. 
>
> Kind Regards,
> Alex.
>
> -------------------
> Alexander Kandzior
>                                                                
> Alkacon Software GmbH  - The OpenCms Experts                  
> http://www.alkacon.com - http://www.opencms.org                 
>
>   
>> -----Original Message-----
>> From: opencms-dev-bounces at opencms.org 
>> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Jorge González
>> Sent: Thursday, September 21, 2006 2:33 PM
>> To: The OpenCms mailing list
>> Subject: [opencms-dev] Different i18n management
>>
>> Hi list:
>>
>> I don't know if it's only bothering to me, but it's a pain to 
>> work with 
>> i18n'ed jsp pages, and restart the container every time I 
>> want to see if 
>> the keys are working ok.
>>
>> I've used other apps, like the itracker issue tracker project (java), 
>> and they solve this kind of problems very well, using a reloadable 
>> bundle with a bundle editor, so you can improve the jsp 
>> creation time, 
>> because you don't have to check and restart every 5 minutes.
>>
>> Do you think this could be a good idea for a new module ?
>>
>>
>> _______________________________________________
>> 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/mailman/listinfo/opencms-dev
>>
>>
>>     
>
>
> _______________________________________________
> 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/mailman/listinfo/opencms-dev
>
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20060922/2cd341ff/attachment.htm>


More information about the opencms-dev mailing list