|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.clirr.core.MessageTranslator
public final class MessageTranslator
Class which is capable of translating a Message object into a localised string.
Field Summary | |
---|---|
static java.lang.String |
DFLT_RESOURCE_NAME
The default base name of the resource bundle from which message descriptions are read. |
Constructor Summary | |
---|---|
MessageTranslator()
This is a singleton class; to get an instance of this class, use the getInstance method. |
Method Summary | |
---|---|
void |
checkComplete(java.util.Collection messages)
Verify that the resource bundle for the currently set locale has a translation string available for every message object in the provided collection. |
java.lang.String |
getDesc(Message msg)
Given a Message object (containing a unique message id), look up that id in the appropriate resource bundle (properties file) for the set locale and return the text string associated with that message id. |
void |
setLocale(java.util.Locale locale)
Define the local language etc. |
void |
setResourceName(java.lang.String resourceName)
Define the base name of the properties file that message translations are to be read from. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DFLT_RESOURCE_NAME
Constructor Detail |
---|
public MessageTranslator()
Method Detail |
---|
public void setLocale(java.util.Locale locale)
locale
- may be a valid Locale object, or null to indicate
that the default locale is to be used.public void setResourceName(java.lang.String resourceName)
public void checkComplete(java.util.Collection messages)
java.util.MissingResourceException
- if there is a registered
message for which no description is present in the current locale's
resources.public java.lang.String getDesc(Message msg)
Message ids in the properties file should be prefixed with an 'm', eg "m1000", "m5003".
java.util.MissingResourceException
- if there is no entry in the
message translation resource bundle for the specified message.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |