Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sourceforge.jsxe.gui
Class Messages

    java.lang.Object
      net.sourceforge.jsxe.gui.Messages

public class Messages
extends Object

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.

- messages.`language`_`country`_`variant`
- messages.`language`_`country`
- messages.`language`
- messages

Since:
  jsXe 0.4 pre1
Version:
  $Id: Messages.java 1036 2006-07-20 15:12:41Z ian_lewis $
Author:
  Trish Hartnett (trishah136@member.fsf.org), Ian Lewis (IanLewis@member.fsf.org)
See Also:
  `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

### Messages

    public Messages()

Method Detail

### initMessages

    public static void initMessages()

### initPluginMessages

    public static void initPluginMessages()

### getLocale

    public Locale getLocale()

  The current locale that jsXe is using to display localized messages.

### setLocale

    public static void setLocale(Locale locale)

  Parameters:
    `locale` - the new locale

### getMessage

    public 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.

  Returns:
    Returns the value of a property from the propertiesObject.

### getMessage

    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.

  You can find out more about this feature by reading the documentation for the `format` method of the `java.text.MessageFormat` class.

  Parameters:
    `name` - The property
    `args` - The positional parameters
  Since:
    jsXe 0.4 pre2

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD