Berin Loritsch wrote:
Stephen McConnell wrote:Berin Loritsch wrote:[EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Stephen J. McConnell mailto:[EMAIL PROTECTED] http://www.osm.net --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
