org.argouml.i18n
Class Translator

java.lang.Object
  |
  +--org.argouml.i18n.Translator

public class Translator
extends java.lang.Object

A tool class to help localization.


Field Summary
private static Logger cat
          logger
private static java.util.Properties images
          Binding between new key names and old ones needed by gef.
private static java.lang.String propertiesFile
          Property file containing the bindings.
 
Constructor Summary
Translator()
           
 
Method Summary
static java.lang.String getImageBinding(java.lang.String name)
          Provide a "gef compliant" image file name.
static java.util.Locale[] getLocales()
          For Locale selection.
static void init()
          Default Locale is set and resources Bundles are loaded.
private static java.util.Properties loadImageBindings(java.lang.String file)
          Loads image bindings from a File.
static java.lang.String localize(java.lang.String key)
          Helper for those that don't want to give the bundle.
static java.lang.String localize(java.lang.String bundle, java.lang.String key)
          Helper for localization to eliminate the need to import the gef util library.
static java.lang.String messageFormat(java.lang.String bundle, 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cat

private static Logger cat
logger


images

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


propertiesFile

private static java.lang.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 java.util.Locale[] getLocales()
For Locale selection.

Returns:
Locales used in ArgoUML

setLocale

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

Parameters:
locale - the new Locale

loadImageBindings

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

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

getImageBinding

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

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

localize

public static java.lang.String localize(java.lang.String bundle,
                                        java.lang.String key)
Helper for localization to eliminate the need to import the gef util library.

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

localize

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

Parameters:
key - to localize
Returns:
the translation

messageFormat

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

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


ArgoUML © 1996-2004 (20040306)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook