I have made some changes to the i18n package to allow explicit selection of a locale. Typically we so stuff like:

Resources I18N = ResourceManager.getPackageResources( Merlin.class );

Which creates a resource based o the default locale. I've updated ResourceManager to support the following:

Resources I18N = ResourceManager.getPackageResources( Merlin.class, locale );

I.e. the declaration of an explicit locale to be used. This change is 100% backward compatible. I've commit the change but can rool it back if anyone has a resonable objection.

Cheers, Steve.

(diff of changes included below)


Index: src/java/org/apache/avalon/excalibur/i18n/ResourceManager.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/i18n/src/java/org/apache/avalon/excalibur/i18n/ResourceManager.java,v
retrieving revision 1.17
diff -r1.17 ResourceManager.java
9a10
> import java.util.Locale;
47a49,62
> return getBaseResources( baseName, Locale.getDefault(), classLoader );
> }
>
> /**
> * Retrieve resource with specified basename.
> *
> * @param baseName the basename
> * @param classLoader the classLoader to load resources from
> * @return the Resources
> */
> public synchronized static final Resources getBaseResources( final String baseName,
> final Locale locale,
> final ClassLoader classLoader )
> {
51c66
< resources = new Resources( baseName, classLoader );
---
> resources = new Resources( baseName, locale, classLoader );
139a155,167
>
> /**
> * Retrieve resource for package relative to the specified class and locale.
> *
> * @param clazz the Class
> * @param locale the locale
> * @return the Resources
> */
> public static final Resources getPackageResources( final Class clazz, Locale locale )
> {
> return getBaseResources( getPackageResourcesBaseName( clazz ), locale, clazz.getClassLoader() );
> }
>

--

Stephen J. McConnell

OSM SARL
digital products for a global economy
mailto:[EMAIL PROTECTED]
http://www.osm.net



--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to