Yes, kind of.  I'm using Freemarker.  There is a master template that all other 
pages extend, if you will, so the i18n tag encompasses the entire content page 
and only has to be defined once.  Anything included within that tag will use 
the specified resource bundle.

Mike 

-----Original Message-----
From: Greg Akins [mailto:angryg...@gmail.com] 
Sent: Friday, July 16, 2010 9:34 AM
To: Mike Fotiou
Cc: user@struts.apache.org
Subject: Re: Any way to load resources in java.util.ResourceBundle

Thanks Mike

On Fri, Jul 16, 2010 at 8:21 AM, Mike Fotiou <mike.fot...@tpsgc-pwgsc.gc.ca> 
wrote:
>  I implemented this by creating my own ResourceBundle implementation 
> ("DataResourceBundle").  This handles all of the database access and returns 
> the appropriate string to Struts by key when asked.
>

We already have a DataResourceBundle.. and I was hoping I could use that.  So 
this is good news.

> Finally, in the view, you must wrap an i18n tag for the text-based tags to 
> work properly:
>
> <@s.i18n name="xxxx.utils.content.DataResourceBundle">

I'm new to Struts, so this might be a stupid question.. is there anyway to 
define that globally?  I'm using SiteMesh, so maybe defining it in a decorator 
might be good enough?

>
> -----Original Message-----
> From: Greg Akins [mailto:angryg...@gmail.com]
> Sent: Friday, July 16, 2010 7:58 AM
> To: user@struts.apache.org
> Subject: Re: Any way to load resources in java.util.ResourceBundle
>
> I'm resurrecting this message because I have the same need.
>
> I'm converting some code to Struts2, from a JSP/Servlet application.
> Currently we create bundles from a database, that have keys per customer and 
> language for most of the text in our application.
>
> A simple solution to this would be to override 
> LocalizedTextUtil.findDefaultText and add a call to our classes that load the 
> text into a ResourceBundle.
>
> However it doesn't look like there is anyway, in Struts 2.1.8.1 to use my own 
> version of LocalizedTextUtil.
>
> Does anyone have any thoughts on how I might do this?
>
> On Wed, Jan 27, 2010 at 12:43 PM, Bhaarat Sharma <bhaara...@xxxxxxxxx>wrote:
>
>> We have seen situations where sometimes the global resource bundles 
>> are lost intermittently for some sessions. We are in a 
>> clustered/shared environment where multiple apps are deployed onto a 
>> GlassFishV2 server.
>> Multiple apps share the struts2 core jars.
>>
>> We have some pages where we have written a custom Resource loader and 
>> everything looks fine on these pages. Problem is on pages that 
>> utilize <s:text name="my.label.name"/>. Our properties files reside 
>> globally in WEB-INF/lib
>>
>> Our custom resource loader works as follows in a JSP
>>
>> <%CustomMessageResrouce cusResource = new 
>> CustomMessageResource("Resource")%>
>> <%= cusResource.getMessage("my.label.name")%>
>>
>> Java code for it looks like:
>> import java.util.ResourceBundle;
>> ResourceBundle resource = ResourceBundle.getBundle(baseName);
>>
>>
>> So we know that loading properties into resourcebundles and using 
>> them as shown above works.
>>
>> My question is..can we do the same for struts2. Can we forcefully 
>> load the resourcebundles inside java.util.ResourceBundle and then 
>> have them be used in <s:text> tag?
>
> --
> Greg Akins
>
> http://insomnia-consulting.org
> http://www.pghcodingdojo.org
> http://pittjug.dev.java.net
> http://twitter.com/akinsgre
> http://www.linkedin.com/in/akinsgre
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>



--
Greg Akins

http://insomnia-consulting.org
http://www.pghcodingdojo.org
http://pittjug.dev.java.net
http://twitter.com/akinsgre
http://www.linkedin.com/in/akinsgre

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to