abbot.i18n
Class Strings

java.lang.Object
  extended by abbot.i18n.Strings

public class Strings
extends Object

Provides support for loading localized strings. Bundles may be added by specifying the full resource name or by a simple name located in com.oculustech.i18n.

Bundles are searched from most- to least-recently added.


Field Summary
static String DIALOG_SUFFIX
          Resources whose name ends with this suffix (".dlg") will automatically be formatted by the dialog formatter.
static String TOOLTIP_SUFFIX
          Resources whose name ends with this suffix (".tip") will automatically be formatted by the tooltip formatter.
 
Method Summary
static void addBundle(ResourceBundle b)
          Add the given ResourceBundle as one to be searched.
static ResourceBundle addBundle(String name)
          Add the given bundle to the list searched.
static ResourceBundle addBundle(String name, ClassLoader cl)
          Add the given bundle to the list searched, loading from the given class loader.
static String get(String key)
          Returns the localized String for the given key, or the key surrounded by '#' if no corresponding localized string is found.
static String get(String key, boolean optional)
          Returns the localized string for the given key.
static String get(String key, Object arg)
          Convenience method for a single-argument format.
static String get(String key, Object[] args)
          Returns a formatted localized string for the given key and arguments, or the key if no corresponding localized string is found.
static String get(String key, Object arg1, Object arg2)
          Convenience method for a two-argument format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOOLTIP_SUFFIX

public static final String TOOLTIP_SUFFIX
Resources whose name ends with this suffix (".tip") will automatically be formatted by the tooltip formatter.

See Also:
TextFormat.tooltip(java.lang.String), Constant Field Values

DIALOG_SUFFIX

public static final String DIALOG_SUFFIX
Resources whose name ends with this suffix (".dlg") will automatically be formatted by the dialog formatter.

See Also:
TextFormat.dialog(java.lang.String), Constant Field Values
Method Detail

addBundle

public static ResourceBundle addBundle(String name)
                                throws MissingResourceException
Add the given bundle to the list searched.

Throws:
MissingResourceException

addBundle

public static ResourceBundle addBundle(String name,
                                       ClassLoader cl)
                                throws MissingResourceException
Add the given bundle to the list searched, loading from the given class loader. The bundle will be weakly referenced.

Throws:
MissingResourceException

addBundle

public static void addBundle(ResourceBundle b)
Add the given ResourceBundle as one to be searched.


get

public static String get(String key)
Returns the localized String for the given key, or the key surrounded by '#' if no corresponding localized string is found.


get

public static String get(String key,
                         boolean optional)
Returns the localized string for the given key. If optional is true, return null, otherwise returns the key surrounded by '#' if no corresponding localized string is found.


get

public static String get(String key,
                         Object[] args)
Returns a formatted localized string for the given key and arguments, or the key if no corresponding localized string is found. Use MessageFormat syntax for the format string and arguments.


get

public static String get(String key,
                         Object arg)
Convenience method for a single-argument format.


get

public static String get(String key,
                         Object arg1,
                         Object arg2)
Convenience method for a two-argument format.



Copyright © 2002-2008 Timothy Wall. All Rights Reserved.
Abbot is hosted on

SourceForge