|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface SimpleLocalizationService
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.
| Field Summary | |
|---|---|
static String |
ROLE
|
static String |
SERVICE_NAME
|
| Method Summary | |
|---|---|
String |
format(String bundleName,
Locale locale,
String key,
Object arg1)
Formats a localized value using the provided object. |
String |
format(String bundleName,
Locale locale,
String key,
Object[] args)
Formats a localized value using the provided objects. |
String |
format(String bundleName,
Locale locale,
String key,
Object arg1,
Object arg2)
Formats a localized value using the provided objects. |
ResourceBundle |
getBundle()
Convenience method to get the default ResourceBundle. |
ResourceBundle |
getBundle(String bundleName)
Returns a ResourceBundle given the bundle name and the default locale information supplied by the configuration. |
ResourceBundle |
getBundle(String bundleName,
Locale locale)
Convenience method to get a ResourceBundle based on name and 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 |
getDefaultLocale()
Retrieves the default Locale (as created from default language and default country). |
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). |
void |
setBundle(String defaultBundle)
This method sets the name of the defaultBundle. |
| Field Detail |
|---|
static final String ROLE
static final String SERVICE_NAME
| Method Detail |
|---|
String getDefaultLanguage()
String getDefaultCountry()
Locale getDefaultLocale()
String getDefaultBundleName()
String[] getBundleNames()
ResourceBundle keys (as specified in the config
file).
ResourceBundle getBundle()
ResourceBundle.
ResourceBundle.ResourceBundle getBundle(String bundleName)
bundleName - Name of bundle.
ResourceBundle getBundle(String bundleName,
Locale locale)
bundleName - Name of bundle.locale - A Locale.
String getString(String bundleName,
Locale locale,
String key)
throws MissingResourceException
bundleName - Name of the bundle to look in first.locale - Locale to get text for.key - Name of the text to retrieve.
MissingResourceExceptionvoid setBundle(String defaultBundle)
defaultBundle - Name of default bundle.
String format(String bundleName,
Locale locale,
String key,
Object arg1)
bundleName - The bundle in which to look for the localizable text.locale - The locale for which to format the text.key - The identifier for the localized text to retrieve,arg1 - The object to use as {0} when formatting the localized text.
format(String, Locale, String, Object[])
String format(String bundleName,
Locale locale,
String key,
Object arg1,
Object arg2)
bundleName - The bundle in which to look for the localizable text.locale - The locale for which to format the text.key - The identifier for the localized text to retrieve,arg1 - The object to use as {0} when formatting the localized text.arg2 - The object to use as {1} when formatting the localized text.
format(String, Locale, String, Object[])
String format(String bundleName,
Locale locale,
String key,
Object[] args)
bundleName - The bundle in which to look for the localizable text.locale - The locale for which to format the text.key - The identifier for the localized text to retrieve,args - The objects to use as {0}, {1}, etc. when
formatting the localized text.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||