Package org.codehaus.plexus.i18n
Class DefaultI18N
java.lang.Object
org.codehaus.plexus.logging.AbstractLogEnabled
org.codehaus.plexus.i18n.DefaultI18N
- All Implemented Interfaces:
I18N
,org.codehaus.plexus.logging.LogEnabled
,org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable
public class DefaultI18N
extends org.codehaus.plexus.logging.AbstractLogEnabled
implements I18N, org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable
-
Field Summary
Fields inherited from interface org.codehaus.plexus.i18n.I18N
ACCEPT_LANGUAGE, ROLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionLooks up the value forkey
in theResourceBundle
referenced bybundleName
, then formats that value for the specifiedLocale
usingargs
.This method returns a ResourceBundle given the bundle name and the Locale information supplied in the HTTP "Accept-Language" header.This method returns a ResourceBundle for the given bundle name and the given Locale.String[]
protected final String
getStringOrNull
(ResourceBundle rb, String key) Gets localized text from a bundle if it's there.void
Called the first time the Service is used.protected void
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Constructor Details
-
DefaultI18N
public DefaultI18N()
-
-
Method Details
-
getDefaultLanguage
- Specified by:
getDefaultLanguage
in interfaceI18N
-
getDefaultCountry
- Specified by:
getDefaultCountry
in interfaceI18N
-
getDefaultBundleName
- Specified by:
getDefaultBundleName
in interfaceI18N
-
getBundleNames
- Specified by:
getBundleNames
in interfaceI18N
-
getBundle
-
getBundle
-
getBundle
This method returns a ResourceBundle given the bundle name and the Locale information supplied in the HTTP "Accept-Language" header. -
getBundle
This method returns a ResourceBundle for the given bundle name and the given Locale. -
getLocale
-
getString
-
getString
-
getString
- Specified by:
getString
in interfaceI18N
- Throws:
MissingResourceException
- Specified key cannot be matched.- See Also:
-
format
-
format
-
format
-
format
-
format
Looks up the value forkey
in theResourceBundle
referenced bybundleName
, then formats that value for the specifiedLocale
usingargs
. -
initialize
public void initialize() throws org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationExceptionCalled the first time the Service is used.- Specified by:
initialize
in interfaceorg.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable
- Throws:
org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException
-
initializeBundleNames
protected void initializeBundleNames() -
getStringOrNull
Gets localized text from a bundle if it's there. Otherwise, returnsnull
(ignoring a possibleMissingResourceException
).
-