org.argouml.i18n
Class Translator

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

public class Translator
extends Object

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


Field Summary
private static Properties images
          Binding between new key names and old ones needed by gef.
private static Logger LOG
          logger
private static String propertiesFile
          Property file containing the bindings.
 
Constructor Summary
Translator()
           
 
Method Summary
static String getImageBinding(String name)
          Provide a "gef compliant" image file name.
static Locale[] getLocales()
          For Locale selection.
static void init()
          Default Locale is set and resources Bundles are loaded.
private static Properties loadImageBindings(String file)
          Loads image bindings from a File.
static String localize(String key)
          Helper for those that don't want to give the bundle.
static String localize(String bundle, String key)
          Deprecated. by Linus Tolke as of 0.17.2. Use localize(String key).
static String messageFormat(String key, Object[] args)
          Generates an localized String with arguments.
static String messageFormat(String bundle, String key, Object[] args)
          Deprecated. by Linus Tolke as of 0.17.2. Use messageFormat(String key, Object[] args).
static void setLocale(Locale locale)
          Change the current Locale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final Logger LOG
logger


images

private static Properties images
Binding between new key names and old ones needed by gef.


propertiesFile

private static String propertiesFile
Property file containing the bindings.

Constructor Detail

Translator

public Translator()
Method Detail

init

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


getLocales

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

Returns:
Locales used in ArgoUML

setLocale

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

Parameters:
locale - the new Locale

loadImageBindings

private static Properties loadImageBindings(String file)
Loads image bindings from a File.

Parameters:
file - the properties file
Returns:
the properties in file

getImageBinding

public static String getImageBinding(String name)
Provide a "gef compliant" image file name.

Parameters:
name - the new i18n key
Returns:
the old i18n key

localize

public static String localize(String bundle,
                              String key)
Deprecated. by Linus Tolke as of 0.17.2. Use localize(String key).

Helper for localization to eliminate the need to import the gef util library.

This is only used when retrieving the strings localized in GEF.

Parameters:
bundle - a binding to a bundle of i18n resources
key - the key to loacalize
Returns:
the translation

localize

public static String localize(String key)
Helper for those that don't want to give the bundle.

Note: This one argument key doesn't seem to work for tags that aren't prefixed with the property file name. We get a NullPointerException.

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

messageFormat

public static String messageFormat(String bundle,
                                   String key,
                                   Object[] args)
Deprecated. by Linus Tolke as of 0.17.2. Use messageFormat(String key, Object[] args).

Generates an localized String with arguments.

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

Parameters:
bundle - a binding to a bundle of i18n resources
key - the key to localize
args - the args as Objects, inserted in the localized String
Returns:
the localized String with inserted arguments

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-2004 (20050222)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook