Ok, I am attaching the src code here - you'll have to clean it up but you get 
the idea how it works;

To start things up, you need to do
1. In web.xml, add  context parameter

    <!-- Define the basename for a resource bundle for I18N -->
    <context-param>
        <param-name>your.localization.contextName</param-name>
        <param-value>CommonResources,ErrorsResources, FooResources, 
</param-value>
    </context-param>

2. on application startup, have a contextlistener that gets that parameter , 
loads MultipleResourceBundleFactory with it and sets it in servlet context - 
LocalizationBundleFactory (implementation for stripes) will look in servlet 
context for it.

3. Make sure to specify LocalizationBundleFactory for stripes filter
        <init-param>
            <param-name>LocalizationBundleFactory.Class</param-name>
            
<param-value>com.markettools.platform.webapp.view.admin.LocalizationBundleFactory</param-value>
        </init-param>


This will satisfy all stripes tags.

However, it's not so easy for JSTL fmt tags - I ended up providing my own 
version since i could not figure out how to stick in my factory in their.  But, 
if you are comfortable with providing bundle names for JSTL, you don't need to 
do anything.


________________________________
From: Alex Wibowo [mailto:[email protected]]
Sent: Thursday, February 19, 2009 4:24 PM
To: Stripes Users List
Subject: Re: [Stripes-users] Separating StripesResources.properties

Hi Leonard,



That will be great..
Thanks a lot for the help!




On Fri, Feb 20, 2009 at 10:38 AM, Leonard Gestrin 
<[email protected]<mailto:[email protected]>> wrote:

I created custom wrapper on top of the ResourceBundle that handle any number of 
property files and configured stripes with custom localization factory that 
makes usage of that.



If interested, I can post the code; the advantage is that you don't care in the 
application where the property is coming from so you don't need to deal with 
knowing which resource bundle to use; the disadvantage is that if you define 
same property key in two bundles, the first one wins.



________________________________

From: Alex Wibowo [mailto:[email protected]<mailto:[email protected]>]
Sent: Thursday, February 19, 2009 3:33 PM
To: Stripes Users List
Subject: [Stripes-users] Separating StripesResources.properties





Is there any way to break down the StripesResources.properties file into 
several bundle, just like using jstl:





<fmt:setBundle basename="admin-resources" var="admin_resources" scope="page"/>

<fmt:message bundle="${admin_resources}" key="menu.position-type"/>



maybe....



<stripes:label for="blah"  bundle="some_bundle"/> ?







Otherwise, whats the best practice? My StripesResources.properties is getting 
too big, and hard to maintain...





Thanks a lot!











--
Best regards,


WiB

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Stripes-users mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/stripes-users



--
Best regards,


WiB

Attachment: LocalizationBundleFactory.java
Description: LocalizationBundleFactory.java

Attachment: MultipleResourceBundleFactory.java
Description: MultipleResourceBundleFactory.java

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to