Package org.apache.sling.i18n
Interface ResourceBundleProvider
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
Modifier and TypeFieldDescriptionstatic final String
Request attribute to get the resource bundle. -
Method Summary
Modifier and TypeMethodDescriptionReturns the defaultLocale
assumed by this instance.getResourceBundle
(String baseName, Locale locale) Returns aResourceBundle
for the given locale.getResourceBundle
(Locale locale) Returns aResourceBundle
for the given locale.
-
Field Details
-
BUNDLE_REQ_ATTR
Request attribute to get the resource bundle.- Since:
- 2.2
- See Also:
-
-
Method Details
-
getDefaultLocale
Locale getDefaultLocale()Returns the defaultLocale
assumed by this instance.- Returns:
- The default locale or
null
.
-
getResourceBundle
Returns aResourceBundle
for the given locale.- Parameters:
locale
- TheLocale
for which to return the resource bundle. If this isnull
the default locale as returned bygetDefaultLocale()
is assumed.- Returns:
- The
ResourceBundle
for the given locale - Throws:
MissingResourceException
- If the service is not capable of returning aResourceBundle
-
getResourceBundle
Returns aResourceBundle
for 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
- TheLocale
for which to return the resource bundle. If this isnull
the default locale as returned bygetDefaultLocale()
is assumed.- Returns:
- The
ResourceBundle
for the given locale - Throws:
MissingResourceException
- If the service is not capable of returning aResourceBundle
-