org.apache.sling.i18n
Interface ResourceBundleProvider

All Known Implementing Classes:
JcrResourceBundleProvider

public interface ResourceBundleProvider

The ResourceBundleProvider service interface defines the API for a service, which is capable of returned ResourceBundle for given any Locale.

This interface defines the service API implemented by the existing implementation. It is not intended to be implemented by application bundles. Rather such bundles should get the ResourceBundleProvider service from the service registry to access the data provided.


Field Summary
static String BUNDLE_REQ_ATTR
          Request attribute to get the resource bundle.
 
Method Summary
 Locale getDefaultLocale()
          Returns the default Locale assumed by this instance.
 ResourceBundle getResourceBundle(Locale locale)
          Returns a ResourceBundle for the given locale.
 ResourceBundle getResourceBundle(String baseName, Locale locale)
          Returns a ResourceBundle for the given locale.
 

Field Detail

BUNDLE_REQ_ATTR

static final String BUNDLE_REQ_ATTR
Request attribute to get the resource bundle.

Since:
2.2
See Also:
Constant Field Values
Method Detail

getDefaultLocale

Locale getDefaultLocale()
Returns the default Locale assumed by this instance.


getResourceBundle

ResourceBundle getResourceBundle(Locale locale)
Returns a ResourceBundle for the given locale.

Parameters:
locale - The Locale for which to return the resource bundle. If this is null the default locale as returned by getDefaultLocale() is assumed.
Returns:
The ResourceBundle for the given locale
Throws:
MissingResourceException - If the service is not capable of returning a ResourceBundle

getResourceBundle

ResourceBundle getResourceBundle(String baseName,
                                 Locale locale)
Returns a ResourceBundle for the given locale.

Parameters:
baseName - The base name for the resource bundle. If this is null, the same resource bundle will be returned as when calling the getResourceBundle(Locale) method.
locale - The Locale for which to return the resource bundle. If this is null the default locale as returned by getDefaultLocale() is assumed.
Returns:
The ResourceBundle for the given locale
Throws:
MissingResourceException - If the service is not capable of returning a ResourceBundle


Copyright © 2007-2013 The Apache Software Foundation. All Rights Reserved.