|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.dna.common.i18n.I18n
@ThreadSafe public final class I18n
Manages the initialization of internationalization (i18n) files, substitution of values within i18n message placeholders, and dynamically reading properties from i18n property files.
Method Summary | |
---|---|
static java.util.Set<java.util.Locale> |
getLocalizationProblemLocales(java.lang.Class i18nClass)
Note, calling this method will not trigger localization of the supplied internationalization class. |
static java.util.Set<java.lang.String> |
getLocalizationProblems(java.lang.Class i18nClass)
Note, calling this method will not trigger localization of the supplied internationalization class. |
static java.util.Set<java.lang.String> |
getLocalizationProblems(java.lang.Class i18nClass,
java.util.Locale locale)
Note, calling this method will not trigger localization of the supplied internationalization class. |
static LocalizationRepository |
getLocalizationRepository()
Get the repository of localized messages. |
boolean |
hasProblem()
|
boolean |
hasProblem(java.util.Locale locale)
|
java.lang.String |
id()
|
static void |
initialize(java.lang.Class i18nClass)
Initializes the internationalization fields declared on the supplied class. |
java.lang.String |
problem()
|
java.lang.String |
problem(java.util.Locale locale)
|
static void |
setLocalizationRepository(LocalizationRepository localizationRepository)
Set the repository of localized messages. |
java.lang.String |
text(java.util.Locale locale,
java.lang.Object... arguments)
Get the localized text for the supplied locale, replacing the parameters in the text with those supplied. |
java.lang.String |
text(java.lang.Object... arguments)
Get the localized text for the current (default) locale , replacing the parameters in the text
with those supplied. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static java.util.Set<java.util.Locale> getLocalizationProblemLocales(java.lang.Class i18nClass)
i18nClass
- The internalization class for which localization problem locales should be returned.
null
.public static java.util.Set<java.lang.String> getLocalizationProblems(java.lang.Class i18nClass)
i18nClass
- The internalization class for which localization problems should be returned.
null
.public static java.util.Set<java.lang.String> getLocalizationProblems(java.lang.Class i18nClass, java.util.Locale locale)
i18nClass
- The internalization class for which localization problems should be returned.locale
- The locale for which localization problems should be returned. If null
, the default locale
will be used.
null
.public static LocalizationRepository getLocalizationRepository()
ClasspathLocalizationRepository
that
uses this class' classloader.
public static void setLocalizationRepository(LocalizationRepository localizationRepository)
null
, a ClasspathLocalizationRepository
instance that
uses this class loader will be used.
localizationRepository
- the localization repository to use; may be null
if the default repository
should be used.public static void initialize(java.lang.Class i18nClass)
I18n
. The supplied class must not be an interface (of course), but has no
restrictions as to what class it may extend or what interfaces it must implement.
i18nClass
- A class declaring one or more public, static, non-final fields of type I18n
.public java.lang.String id()
public boolean hasProblem()
true
if a problem was encountered while localizing this internationalization object to the default
locale.public boolean hasProblem(java.util.Locale locale)
locale
- The locale for which to check whether a problem was encountered.
true
if a problem was encountered while localizing this internationalization object to the supplied
locale.public java.lang.String problem()
null
if none was encountered.public java.lang.String problem(java.util.Locale locale)
locale
- The locale for which to return the problem.
null
if none was encountered.public java.lang.String text(java.lang.Object... arguments)
current (default) locale
, replacing the parameters in the text
with those supplied.
arguments
- the arguments for the parameter replacement; may be null
or empty
public java.lang.String text(java.util.Locale locale, java.lang.Object... arguments)
locale
- the locale, or null
if the current (default) locale
should be usedarguments
- the arguments for the parameter replacement; may be null
or empty
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |