public class DefaultI18N extends org.codehaus.plexus.logging.AbstractLogEnabled implements I18N, org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable
ACCEPT_LANGUAGE, ROLE| Constructor and Description |
|---|
DefaultI18N() |
| Modifier and Type | Method and Description |
|---|---|
String |
format(String bundleName,
Locale locale,
String key,
Object arg1) |
String |
format(String bundleName,
Locale locale,
String key,
Object[] args)
Looks up the value for
key in the
ResourceBundle referenced by
bundleName, then formats that value for the
specified Locale using args. |
String |
format(String bundleName,
Locale locale,
String key,
Object arg1,
Object arg2) |
String |
format(String key,
Object arg1) |
String |
format(String key,
Object arg1,
Object arg2) |
ResourceBundle |
getBundle() |
ResourceBundle |
getBundle(String bundleName) |
ResourceBundle |
getBundle(String bundleName,
Locale locale)
This method returns a ResourceBundle for the given bundle name
and the given Locale.
|
ResourceBundle |
getBundle(String bundleName,
String languageHeader)
This method returns a ResourceBundle given the bundle name and
the Locale information supplied in the HTTP "Accept-Language"
header.
|
String[] |
getBundleNames() |
String |
getDefaultBundleName() |
String |
getDefaultCountry() |
String |
getDefaultLanguage() |
Locale |
getLocale(String header) |
String |
getString(String key) |
String |
getString(String key,
Locale locale) |
String |
getString(String bundleName,
Locale locale,
String key) |
protected String |
getStringOrNull(ResourceBundle rb,
String key)
Gets localized text from a bundle if it's there.
|
void |
initialize()
Called the first time the Service is used.
|
protected void |
initializeBundleNames() |
public String getDefaultLanguage()
getDefaultLanguage in interface I18Npublic String getDefaultCountry()
getDefaultCountry in interface I18Npublic String getDefaultBundleName()
getDefaultBundleName in interface I18Npublic String[] getBundleNames()
getBundleNames in interface I18Npublic ResourceBundle getBundle()
public ResourceBundle getBundle(String bundleName)
public ResourceBundle getBundle(String bundleName, String languageHeader)
public ResourceBundle getBundle(String bundleName, Locale locale)
public Locale getLocale(String header)
getLocale in interface I18NI18N.getLocale(String)public String getString(String bundleName, Locale locale, String key)
getString in interface I18NMissingResourceException - Specified key cannot be matched.I18N.getString(String, Locale, String)public String format(String bundleName, Locale locale, String key, Object arg1)
format in interface I18NI18N.format(String, Locale, String, Object)public String format(String bundleName, Locale locale, String key, Object arg1, Object arg2)
format in interface I18NI18N.format(String, Locale, String, Object, Object)public String format(String bundleName, Locale locale, String key, Object[] args)
key in the
ResourceBundle referenced by
bundleName, then formats that value for the
specified Locale using args.public void initialize()
throws org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException
initialize in interface org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializableorg.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationExceptionprotected void initializeBundleNames()
protected final String getStringOrNull(ResourceBundle rb, String key)
null (ignoring a possible
MissingResourceException).Copyright © 2001–2015 Codehaus Plexus. All rights reserved.