avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen McConnell <mcconn...@apache.org>
Subject Re: cvs commit: avalon-excalibur/i18n/src/java/org/apache/avalon/excalibur/i18n ResourceManager.java
Date Sat, 08 Feb 2003 22:01:01 GMT


Berin Loritsch wrote:

> Stephen McConnell wrote:
>
>>
>>
>> Berin Loritsch wrote:
>>
>>> mcconnell@apache.org wrote:
>>>
>>>> mcconnell    2003/02/07 14:17:08
>>>>
>>>>   Modified:    i18n     default.properties
>>>>                i18n/src/java/org/apache/avalon/excalibur/i18n
>>>>                         ResourceManager.java
>>>>   Log:
>>>>   Moving back to 1.0 status.
>>>
>>>
>>>
>>>
>>>
>>> Was there something wrong with the code?  Why are you reverting the
>>> change?
>>
>>
>>
>>
>> Because its possible to set the locale using Locale.setDefault( 
>> locale ) which nagates the changes I made.
>
>
> It is consistent with the way the ResourceBundle works, which is why it
> surprised me that you removed the functionality.  It is both a
> convenience and an API consistency to have the ResourceManager mimic
> the way you get ResourceBundles.


Problem noted by Pete1 and Pete2 is that the main function of the 
ResourceManager is to establish and maintain a cache of the Resource 
keyed by class.  With the operation including the locale - it works fine 
for setup but is inconsistent on retrival bacause you want to get back 
the cached value and the addition argument would mean that we would have 
to test the supplied locale against the cached locale on every 
invocation. Given that the ResourceManager is explicity an cache thing - 
its easier to invoke the Local.setDefault( locale ) before the setup or 
updating of the ResourceManager.

E.g.:

   Locale.setDefault( new Locale( "fr" ) );
   Resources I18N = ResourceManager.getPackageResources( TheClass.class );

Cheers, Steve.

>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
> For additional commands, e-mail: dev-help@avalon.apache.org
>
>
>

-- 

Stephen J. McConnell
mailto:mcconnell@apache.org
http://www.osm.net




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Mime
View raw message