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

Peter A. Pilgrim peterp at xenonsoft.demon.co.uk
Sat Aug 9 02:54:08 PDT 2003


Raul DAVIDOVICH wrote:

--//--

> 
> First, since it's already a part of Struts, and it has no dependencies 
> on other components, for us, at a first time it would only mean to 
> update the commons and struts jars. Because of the way you're asking, I 
> believe none of these classes are directly used in expresso.
> 
> 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.
> 
>  
> 
> I cannot say much more, since most of the links on the site are broken, 
> and there's no doc at all.
> 
>  
> 
>  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)

--////--

> 
> look forward to hearing other people's comments

String myMessage2 = myPMR.getMessage( locale, key, obj1, obj2, obj3 );

Looking at the API source file, took me a while.

http://jakarta.apache.org/commons/sandbox/resources/xref/org/apache/commons/resources/message/PropertyMessageResources.html

You should be able create ``DBObjectMessageResourcesFactory'' and
``DBObjectMessageResource''.

// Register the factory

MessageResourcesFactory myMRF = MessageResourcesFactory().setFactory(
   DBObjectMessageResourceFactory );

// Create the resources

MessageResources myMR = myMRF.createResources();

// Get resources

String myMessage3 = myMR.getMessage( locale, key, obj1, obj2, obj3 );

Probably need to pass the `dbcontext' to the factory some how.

-- 
Peter Pilgrim
            __ _____ _____ _____
           / //__  // ___// ___/   +  Serverside Java
          / /___/ // /__ / /__     +  Struts
         / // ___// ___// ___/     +  Expresso Committer
      __/ // /__ / /__ / /__       +  Independent Contractor
     /___//____//____//____/       +  Intrinsic Motivation
On Line Resume
    ||
    \\===>  `` http://www.xenonsoft.demon.co.uk/no-it-striker.html ''




More information about the Opensource mailing list