[Opensource] Re: [Opensource] Réf. : [Opensource] [ Volunteer Call] Review Commons -Resources

Michael Rimov rimovm at centercomp.com
Sun Aug 10 06:36:40 PDT 2003


At 09:29 AM 8/7/2003 +0200, you wrote:
>Second, from what I could understand, we might be able to use I18N codes 
>from inside any component, not just the web pages, like a DBObject or a 
>Controller for instance (please forgive my ignorance if it's already the 
>case). If it's the case, I think it would be worthwile to adopt it, since 
>it would ease up a lot i18n use.

Actually, you can get localized strings from pretty much anywhere within 
expresso.  The resource bundles are grouped by Schema.  [Which is too much 
scope IMO, I agree with Kris that I'd like to see it able to be broken down 
to per-controller, etc... not to mention that using SoftReferences, we can 
save lots of memory and only tend to keep in memory the strings that we need]


> From what I could see in the javadoc, the use should be something like this:
>
>...
>
>MessageResourcesFactory myPMRF = 
>PropertyMessageResourcesFactory().createFactory() ;
>
>MessageResources myPMR = myPMRF.createResources;
>
>String myMessage = myPMR.getMessage(java.util.Locale locale, 
>java.lang.String key)

I saw Peter forwarded some of the discussion to the struts developer list 
with some of this own thoughts (Thanks Peter!).  I guess the key will be 
auto-resolving ControllerResponse.getString() with the appropriate 
MessageResources class.

I also saw that they plan on using commons-resources post 1.2 so we have 
some time... but perhaps [And this is more directed towards Peter:] we 
could figure out a way to merge ISOValidValues and ValidValues, and the 
current getStrings() stuff under a single API?

Thanks for checking it out!
                                                 -Mike







More information about the Opensource mailing list