|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.moyoman.framework.MessageTool
This class provides methods for updating message files, and creating new ones. The writer of a message updating/translation user interface would use the api of this class to accomplish the back end work.
Constructor Summary | |
MessageTool()
|
Method Summary | |
static Message |
createLanguage(String langName,
String displayName)
Create a new language. |
static String[] |
getIncompleteLanguages()
Return those languages that do not have all messages defined. |
static String |
getMessage(String displayableLanguageName,
String symbolicMessageName)
Get a message for the given language and message type. |
static String[] |
getMissingMessages(String langName)
Return those messages which are undefined for the specified language. |
static void |
main(String[] args)
This is used for unit testing, as well as illustrating how to translate a language. |
static void |
removeMessage(String langName,
String key)
Remove the message type from the specified language. |
static void |
reset(String langName)
Undo all changes made to the specified language since the last reset() or save() call. |
static void |
save(String langName)
Save the results of a particular language to permanent storage. |
static void |
setMessage(String langName,
String name,
String value)
Set the message for the given language and message type. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MessageTool()
Method Detail |
public static void main(String[] args)
args
- An array of command line arguments, which are not used.public static Message createLanguage(String langName, String displayName) throws DataAlreadyExistsException
langName
- - The language name, which should only contain ASCII letters and numbers,
or a hyphen or underscore, e.g, chinese_prcdisplayName
- - This is the string to be displayed to the user.
It can be any Unicode string, but should end in an English translation
in parentheses if not understandable to an English speaker, e.g, (Chinese-Singapore).
DataAlreadyExistsException
- Thrown if either the country of displayName
parameters are not unique.public static String getMessage(String displayableLanguageName, String symbolicMessageName) throws NoSuchDataException
displayableLanguageName
- - The displayable name of the language.symbolicMessageName
- - The symbolic name of the message type.
NoSuchDataException
- Thrown if the localized message does not exist.public static void setMessage(String langName, String name, String value) throws IllegalArgumentException
langName
- - The displayable name of the language.name
- - The symbolic name of the message type.value
- - The localized message.
IllegalArgumentException
- Thrown if any of the parameters are incorrect.public static void save(String langName) throws InternalErrorException
langName
- The displayable name of the language.
InternalErrorException
- Thrown if an error occurs for any reason.public static String[] getIncompleteLanguages()
public static String[] getMissingMessages(String langName) throws NoSuchDataException
langName
- - The displayable name of the language in question.
NoSuchDataException
- Thrown if the language is unknown.public static void removeMessage(String langName, String key)
langName
- The displayable language name.key
- The symbolic message name.public static void reset(String langName) throws InternalErrorException
langName
- The displayable language name.
InternalErrorException
- Thrown if the operation fails for any reason.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |