| org.apache.turbine.services.localization.LocalizationService
All known Subclasses: org.apache.turbine.services.localization.TurbineLocalizationService,
LocalizationService | public interface LocalizationService extends Service(Code) | | Provides localization functionality using the interface provided
by ResourceBundle , plus leverages a "search path"
style traversal of the ResourceBundle objects named by
the locale.default.bundles to discover a value for a
given key.
It is suggested that one handle
dealing with concatenated messages
using MessageFormat and properties files.
author: Jon S. Stevens author: Daniel Rall author: Leonard Richardson version: $Id: LocalizationService.java 534527 2007-05-02 16:10:59Z tv $ |
Method Summary | |
String | format(String bundleName, Locale locale, String key, Object arg1) Formats a localized value using the provided object.
Parameters: bundleName - The bundle in which to look for the localizable text. Parameters: locale - The locale for which to format the text. Parameters: key - The identifier for the localized text to retrieve, Parameters: arg1 - The object to use as {0} when formatting the localized text. | String | format(String bundleName, Locale locale, String key, Object arg1, Object arg2) Formats a localized value using the provided objects.
Parameters: bundleName - The bundle in which to look for the localizable text. Parameters: locale - The locale for which to format the text. Parameters: key - The identifier for the localized text to retrieve, Parameters: arg1 - The object to use as {0} when formatting the localized text. Parameters: arg2 - The object to use as {1} when formatting the localized text. | String | format(String bundleName, Locale locale, String key, Object[] args) Formats a localized value using the provided objects.
Parameters: bundleName - The bundle in which to look for the localizable text. Parameters: locale - The locale for which to format the text. Parameters: key - The identifier for the localized text to retrieve, Parameters: args - The objects to use as {0}, {1}, etc. | ResourceBundle | getBundle() Convenience method to get a default ResourceBundle. | ResourceBundle | getBundle(String bundleName) Returns a ResourceBundle given the bundle name and the default
locale information supplied by the configuration.
Parameters: bundleName - Name of bundle. | ResourceBundle | getBundle(String bundleName, String languageHeader) Convenience method to get a ResourceBundle based on name and
HTTP Accept-Language header.
Parameters: bundleName - Name of bundle. Parameters: languageHeader - A String with the language header. | ResourceBundle | getBundle(HttpServletRequest req) Convenience method to get a ResourceBundle based on HTTP
Accept-Language header in HttpServletRequest.
Parameters: req - The HTTP request to parse theAccept-Language of. | ResourceBundle | getBundle(String bundleName, HttpServletRequest req) Convenience method to get a ResourceBundle based on name and
HTTP Accept-Language header in HttpServletRequest.
Parameters: bundleName - Name of bundle. Parameters: req - The HTTP request to parse theAccept-Language of. | ResourceBundle | getBundle(String bundleName, Locale locale) Convenience method to get a ResourceBundle based on name and
Locale.
Parameters: bundleName - Name of bundle. Parameters: locale - A Locale. | String[] | getBundleNames() Retrieves the list of names of bundles to search by default for
ResourceBundle keys (as specified in the config
file). | String | getDefaultBundleName() Retrieves the name of the default bundle (as specified in the
config file), or the first in the list if there are more than
one. | String | getDefaultCountry() Retrieves the default country (as specified in the config
file). | String | getDefaultLanguage() Retrieves the default language (as specified in the config
file). | Locale | getLocale(HttpServletRequest req) Attempts to pull the Accept-Language header out of
the HttpServletRequest object and then parse it.
If the header is not present, it will return a
null Locale .
Parameters: req - The HTTP request to parse theAccept-Language of. | Locale | getLocale(String languageHeader) This method parses the Accept-Language header and
attempts to create a Locale out of it.
Parameters: languageHeader - The Accept-Language HTTPheader. | String | getString(String bundleName, Locale locale, String key) Tries very hard to return a value, looking first in the
specified bundle, then searching list of default bundles
(giving precedence to earlier bundles over later bundles).
Parameters: bundleName - Name of the bundle to look in first. Parameters: locale - Locale to get text for. Parameters: key - Name of the text to retrieve. | void | setBundle(String defaultBundle) This method sets the name of the defaultBundle. |
ACCEPT_LANGUAGE | String ACCEPT_LANGUAGE(Code) | | A constant for the HTTP Accept-Language header.
|
SERVICE_NAME | String SERVICE_NAME(Code) | | The name of this service.
|
format | String format(String bundleName, Locale locale, String key, Object arg1)(Code) | | Formats a localized value using the provided object.
Parameters: bundleName - The bundle in which to look for the localizable text. Parameters: locale - The locale for which to format the text. Parameters: key - The identifier for the localized text to retrieve, Parameters: arg1 - The object to use as {0} when formatting the localized text. Formatted localized text. See Also: LocalizationService.format(String,Locale,String,Object[]) |
format | String format(String bundleName, Locale locale, String key, Object arg1, Object arg2)(Code) | | Formats a localized value using the provided objects.
Parameters: bundleName - The bundle in which to look for the localizable text. Parameters: locale - The locale for which to format the text. Parameters: key - The identifier for the localized text to retrieve, Parameters: arg1 - The object to use as {0} when formatting the localized text. Parameters: arg2 - The object to use as {1} when formatting the localized text. Formatted localized text. See Also: LocalizationService.format(String,Locale,String,Object[]) |
format | String format(String bundleName, Locale locale, String key, Object[] args)(Code) | | Formats a localized value using the provided objects.
Parameters: bundleName - The bundle in which to look for the localizable text. Parameters: locale - The locale for which to format the text. Parameters: key - The identifier for the localized text to retrieve, Parameters: args - The objects to use as {0}, {1}, etc. whenformatting the localized text. Formatted localized text. |
getBundle | ResourceBundle getBundle()(Code) | | Convenience method to get a default ResourceBundle.
A localized ResourceBundle. |
getBundle | ResourceBundle getBundle(String bundleName)(Code) | | Returns a ResourceBundle given the bundle name and the default
locale information supplied by the configuration.
Parameters: bundleName - Name of bundle. A localized ResourceBundle. |
getBundle | ResourceBundle getBundle(String bundleName, String languageHeader)(Code) | | Convenience method to get a ResourceBundle based on name and
HTTP Accept-Language header.
Parameters: bundleName - Name of bundle. Parameters: languageHeader - A String with the language header. A localized ResourceBundle. |
getBundle | ResourceBundle getBundle(HttpServletRequest req)(Code) | | Convenience method to get a ResourceBundle based on HTTP
Accept-Language header in HttpServletRequest.
Parameters: req - The HTTP request to parse theAccept-Language of. A localized ResourceBundle. |
getBundle | ResourceBundle getBundle(String bundleName, HttpServletRequest req)(Code) | | Convenience method to get a ResourceBundle based on name and
HTTP Accept-Language header in HttpServletRequest.
Parameters: bundleName - Name of bundle. Parameters: req - The HTTP request to parse theAccept-Language of. A localized ResourceBundle. |
getBundle | ResourceBundle getBundle(String bundleName, Locale locale)(Code) | | Convenience method to get a ResourceBundle based on name and
Locale.
Parameters: bundleName - Name of bundle. Parameters: locale - A Locale. A localized ResourceBundle. |
getBundleNames | String[] getBundleNames()(Code) | | Retrieves the list of names of bundles to search by default for
ResourceBundle keys (as specified in the config
file).
The list of configured bundle names. |
getDefaultBundleName | String getDefaultBundleName()(Code) | | Retrieves the name of the default bundle (as specified in the
config file), or the first in the list if there are more than
one.
|
getDefaultCountry | String getDefaultCountry()(Code) | | Retrieves the default country (as specified in the config
file).
|
getDefaultLanguage | String getDefaultLanguage()(Code) | | Retrieves the default language (as specified in the config
file).
|
getLocale | Locale getLocale(HttpServletRequest req)(Code) | | Attempts to pull the Accept-Language header out of
the HttpServletRequest object and then parse it.
If the header is not present, it will return a
null Locale .
Parameters: req - The HTTP request to parse theAccept-Language of. The parsed locale. |
getLocale | Locale getLocale(String languageHeader)(Code) | | This method parses the Accept-Language header and
attempts to create a Locale out of it.
Parameters: languageHeader - The Accept-Language HTTPheader. The parsed locale. |
getString | String getString(String bundleName, Locale locale, String key)(Code) | | Tries very hard to return a value, looking first in the
specified bundle, then searching list of default bundles
(giving precedence to earlier bundles over later bundles).
Parameters: bundleName - Name of the bundle to look in first. Parameters: locale - Locale to get text for. Parameters: key - Name of the text to retrieve. Localized text. |
setBundle | void setBundle(String defaultBundle)(Code) | | This method sets the name of the defaultBundle.
Parameters: defaultBundle - Name of default bundle. |
|
|