org.argouml.i18n
Class Translator

java.lang.Object
  extended byorg.argouml.i18n.Translator

public final class Translator
extends Object

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


Method Summary
static void addClassLoader(ClassLoader cl)
          Add another class loader that the resource bundle could be located through.
static Locale[] getLocales()
          For Locale selection.
static void init()
          Default Locale is set and resources Bundles are loaded.
static String localize(String key)
          The main function of this class that localizes strings.
static String localize(String key, Object[] args)
          Synonym for messageFormat to encourage developers to convert existing uses of localize() + string concatentation to use this method instead.
static String messageFormat(String key, Object[] args)
          Generates an localized String with arguments.
static void setLocale(Locale locale)
          Change the current Locale.
static void setLocale(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

init

public static void init()
Default Locale is set and resources Bundles are loaded.


getLocales

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

TODO: Detect the available locales from the available files.

Returns:
Locales used in ArgoUML

setLocale

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

language [ "_" country ]

Parameters:
name - the name of the new locale

setLocale

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

Parameters:
locale - the new Locale

addClassLoader

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

Parameters:
cl - The classloader to add.

localize

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

See Also:
messageFormat(String, Object[])

localize

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

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

messageFormat

public static String messageFormat(String key,
                                   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 args as Objects, inserted in the localized String
Returns:
the localized String with inserted arguments


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook