|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.jsxe.gui.Messages
Messages is the mechanism that jsXe uses to localize messages into the
locale of the user. This class will automatically use the current default
locale of the system but this can be overridden by calling the
#setLanguage(String)
method.
Messages are automatically loaded from the properties files located in the
'messages' directory in the jsXe install directory. The messages files are
names with the format messages.language
.country
.variant
.
The Messages class searches these files in the following order.
Messages files should be in a format that the Properties
class
can understand. This means that messages files that contain localized
characters should have the native2ascii tool run on them. This ensures
that these characters are in the \\u... format that can be read by the
Properties
class.
language
_country
_variant
language
_country
language
Locale
Constructor Summary | |
Messages()
|
Method Summary | |
Locale |
getLocale()
The current locale that jsXe is using to display localized messages. |
static String |
getMessage(String propertyName)
Returns the message with the specified name. |
static String |
getMessage(String name,
Object[] args)
Returns the message with the specified name. |
static void |
initMessages()
|
static void |
initPluginMessages()
|
static void |
setLocale(Locale locale)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Messages()
Method Detail |
public static void initMessages()
public static void initPluginMessages()
public Locale getLocale()
public static void setLocale(Locale locale)
locale
- the new localepublic static String getMessage(String propertyName)
Returns the message with the specified name. When a Messages is queried for a message it first looks for the message in the current language and returns it. If it cannot find the message in the messages for the current language it looks for it in english and returns it. If it still doesn't find the message it returns null.
public static String getMessage(String name, Object[] args)
Returns the message with the specified name. When a Messages is queried for a message it first looks for the message in the current language and returns it. If it cannot find the message in the messages for the current language it looks for it in english and returns it. If it still doesn't find the message it returns null.
The elements of the args
array are substituted
into the value of the property in place of strings of the
form {n}
, where n
is an index
in the array.
format
method of the
java.text.MessageFormat
class.
name
- The propertyargs
- The positional parameters
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |