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 I18N
public String getDefaultCountry()
getDefaultCountry
in interface I18N
public String getDefaultBundleName()
getDefaultBundleName
in interface I18N
public String[] getBundleNames()
getBundleNames
in interface I18N
public 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 I18N
I18N.getLocale(String)
public String getString(String bundleName, Locale locale, String key)
getString
in interface I18N
MissingResourceException
- Specified key cannot be matched.I18N.getString(String, Locale, String)
public String format(String bundleName, Locale locale, String key, Object arg1)
format
in interface I18N
I18N.format(String, Locale, String, Object)
public String format(String bundleName, Locale locale, String key, Object arg1, Object arg2)
format
in interface I18N
I18N.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.Initializable
org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException
protected void initializeBundleNames()
protected final String getStringOrNull(ResourceBundle rb, String key)
null
(ignoring a possible
MissingResourceException
).Copyright © 2001–2015 Codehaus Plexus. All rights reserved.