Package org.apache.sling.i18n
Interface ResourceBundleProvider
-
public interface ResourceBundleProviderTheResourceBundleProviderservice interface defines the API for a service, which is capable of returnedResourceBundlefor given anyLocale.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
ResourceBundleProviderservice from the service registry to access the data provided.
-
-
Field Summary
Fields Modifier and Type Field Description static StringBUNDLE_REQ_ATTRRequest attribute to get the resource bundle.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description LocalegetDefaultLocale()Returns the defaultLocaleassumed by this instance.ResourceBundlegetResourceBundle(String baseName, Locale locale)Returns aResourceBundlefor the given locale.ResourceBundlegetResourceBundle(Locale locale)Returns aResourceBundlefor 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 defaultLocaleassumed by this instance.- Returns:
- The default locale or
null.
-
getResourceBundle
ResourceBundle getResourceBundle(Locale locale)
Returns aResourceBundlefor the given locale.- Parameters:
locale- TheLocalefor which to return the resource bundle. If this isnullthe default locale as returned bygetDefaultLocale()is assumed.- Returns:
- The
ResourceBundlefor the given locale - Throws:
MissingResourceException- If the service is not capable of returning aResourceBundle
-
getResourceBundle
ResourceBundle getResourceBundle(String baseName, Locale locale)
Returns aResourceBundlefor the given locale.- Parameters:
baseName- The base name for the resource bundle. If this isnull, the same resource bundle will be returned as when calling thegetResourceBundle(Locale)method.locale- TheLocalefor which to return the resource bundle. If this isnullthe default locale as returned bygetDefaultLocale()is assumed.- Returns:
- The
ResourceBundlefor the given locale - Throws:
MissingResourceException- If the service is not capable of returning aResourceBundle
-
-