org.argouml.i18n
Class Translator

java.lang.Object
  extended by org.argouml.i18n.Translator

public final class Translator
extends java.lang.Object

The API class to the localization. All localization calls goes through this class.


Method Summary
static void addClassLoader(java.lang.ClassLoader cl)
          Add another class loader that the resource bundle could be located through.
static java.util.Locale[] getLocales()
          For Locale selection.
static java.util.Locale getSystemDefaultLocale()
          Returns the original value of the default locale for this instance of the Java Virtual Machine (which is independent from the selected configuration).
static void init(java.lang.String locale)
          Initialize the locale.
static void initForEclipse(java.lang.String locale)
          Alternate initialization entry point for use by ArgoEclipse.
static java.lang.String localize(java.lang.String key)
          The main function of this class that localizes strings.
static java.lang.String localize(java.lang.String key, java.lang.Object[] args)
          Synonym for messageFormat to encourage developers to convert existing uses of localize() + string concatenation to use this method instead.
static java.lang.String messageFormat(java.lang.String key, java.lang.Object[] args)
          Generates an localized String with arguments.
static void setLocale(java.util.Locale locale)
          Change the current Locale.
static void setLocale(java.lang.String name)
          Change the current Locale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

initForEclipse

public static void initForEclipse(java.lang.String locale)
Alternate initialization entry point for use by ArgoEclipse. It leaves out telling GEF about bundles that it won't be able to access.

NOTE: This must be called *before* any other methods are called to work properly.

Parameters:
locale - the configured locale or "" or null

init

public static void init(java.lang.String locale)
Initialize the locale.

Parameters:
locale - a string with the locale

getLocales

public static java.util.Locale[] getLocales()
For Locale selection.

TODO: Detect the available locales from the available files.

Returns:
Locales used in ArgoUML

setLocale

public static void setLocale(java.lang.String name)
Change the current Locale. The string with the name follows this BNF format:

language [ "_" country ]

Only use this before the GUI is initialized.

Parameters:
name - the name of the new locale

setLocale

public static void setLocale(java.util.Locale locale)
Change the current Locale.

Only use this before the GUI is initialized.

Parameters:
locale - the new Locale

getSystemDefaultLocale

public static java.util.Locale getSystemDefaultLocale()
Returns the original value of the default locale for this instance of the Java Virtual Machine (which is independent from the selected configuration).

Returns:
the original system default locale

addClassLoader

public static void addClassLoader(java.lang.ClassLoader cl)
Add another class loader that the resource bundle could be located through.

Parameters:
cl - The ClassLoader to add.

localize

public static java.lang.String localize(java.lang.String key,
                                        java.lang.Object[] args)
Synonym for messageFormat to encourage developers to convert existing uses of localize() + string concatenation to use this method instead.

The localized string is a pattern to be processed by MessageFormat.

Parameters:
key - the key to localize
args - the arguments as Objects to be inserted in string
Returns:
String the localized string
See Also:
messageFormat(String, Object[])

localize

public static java.lang.String localize(java.lang.String key)
The main function of this class that localizes strings.

Parameters:
key - The key to localize.
Returns:
The localized String.

messageFormat

public static java.lang.String messageFormat(java.lang.String key,
                                             java.lang.Object[] args)
Generates an localized String with arguments.

The localized string is a pattern to be processed by MessageFormat.

Parameters:
key - the key to localize
args - the arguments as Objects, inserted in the localized String
Returns:
the localized String with inserted arguments


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook