|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 Set<Locale> |
getLocalizationProblemLocales(Class<?> i18nClass)
Note, calling this method will not trigger localization of the supplied internationalization class. |
static Set<String> |
getLocalizationProblems(Class<?> i18nClass)
Note, calling this method will not trigger localization of the supplied internationalization class. |
static Set<String> |
getLocalizationProblems(Class<?> i18nClass,
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(Locale locale)
|
String |
id()
|
static void |
initialize(Class<?> i18nClass)
Initializes the internationalization fields declared on the supplied class. |
String |
problem()
|
String |
problem(Locale locale)
|
static void |
setLocalizationRepository(LocalizationRepository localizationRepository)
Set the repository of localized messages. |
String |
text(Locale locale,
Object... arguments)
Get the localized text for the supplied locale, replacing the parameters in the text with those supplied. |
String |
text(Object... arguments)
Get the localized text for the current (default) locale , replacing the parameters in the text
with those supplied. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static Set<Locale> getLocalizationProblemLocales(Class<?> i18nClass)
i18nClass
- The internalization class for which localization problem locales should be returned.
null
.public static Set<String> getLocalizationProblems(Class<?> i18nClass)
i18nClass
- The internalization class for which localization problems should be returned.
null
.public static Set<String> getLocalizationProblems(Class<?> i18nClass, 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(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 String id()
public boolean hasProblem()
true
if a problem was encountered while localizing this internationalization object to the default
locale.public boolean hasProblem(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 String problem()
null
if none was encountered.public String problem(Locale locale)
locale
- The locale for which to return the problem.
null
if none was encountered.public String text(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 String text(Locale locale, 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 String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |