|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.zkoss.util.resource.Labels
public class Labels
Utilities to access labels. A label is a Locale-dependent string that is stored in i3-label*properties.
Method Summary | |
---|---|
static java.lang.String |
getLabel(java.lang.String key)
Returns the label of the specified key based on the current Locale, or null if no found. |
static java.lang.String |
getLabel(java.lang.String key,
java.lang.Object[] args)
Returns the label of the specified key and formats it with the specified argument, or null if not found. |
static java.lang.String |
getLabel(java.lang.String key,
java.lang.String defValue)
Returns the label of the specified key based on the current Locale, or the default value if no found. |
static java.lang.String |
getLabel(java.lang.String key,
java.lang.String defValue,
java.lang.Object[] args)
Returns the label of the specified key and formats it with the specified argument, or the default value if not found. |
static java.lang.String |
getRequiredLabel(java.lang.String key)
Returns the label of the specified key based on the current locale. |
static java.lang.String |
getRequiredLabel(java.lang.String key,
java.lang.Object[] args)
Returns the label of the specified key and formats it with the specified argument, or null if not found. |
static void |
register(LabelLocator locator)
Registers a locator which is used to load i3-label*.properties from other resource, such as servlet contexts. |
static void |
reset()
Resets all cached labels and next call to getLabel(String)
will cause re-loading i3-label*.proerties. |
static VariableResolver |
setVariableResolver(VariableResolver resolv)
Sets the variable resolver, which is used if an EL expression is specified. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static final java.lang.String getLabel(java.lang.String key)
The current locale is given by Locales.getCurrent()
.
public static final java.lang.String getLabel(java.lang.String key, java.lang.Object[] args)
It first uses getLabel(String)
to load the label.
Then, it, if not null, invokes MessageFormats.format(java.lang.String, java.lang.Object[], java.util.Locale)
to format it.
The current locale is given by Locales.getCurrent()
.
public static final java.lang.String getLabel(java.lang.String key, java.lang.String defValue)
The current locale is given by Locales.getCurrent()
.
defValue
- the value being returned if the key is not foundpublic static final java.lang.String getLabel(java.lang.String key, java.lang.String defValue, java.lang.Object[] args)
It first uses getLabel(String, String)
to load the label.
Then, it, if not null, invokes MessageFormats.format(java.lang.String, java.lang.Object[], java.util.Locale)
to format it.
The current locale is given by Locales.getCurrent()
.
defValue
- the value being returned if the key is not foundpublic static final java.lang.String getRequiredLabel(java.lang.String key) throws SystemException
getLabel(String)
, it throws an exception if not found.
SystemException
- if no such labelpublic static final java.lang.String getRequiredLabel(java.lang.String key, java.lang.Object[] args)
getLabel(String, Object[])
, it throws an exception if not found.
The current locale is given by Locales.getCurrent()
.
SystemException
- if no such labelpublic static final void reset()
getLabel(String)
will cause re-loading i3-label*.proerties.
public static final VariableResolver setVariableResolver(VariableResolver resolv)
Default: no resolver at all.
public static final void register(LabelLocator locator)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |