com.vividsolutions.jump
Class I18N

java.lang.Object
  extended by com.vividsolutions.jump.I18N

public final class I18N
extends java.lang.Object

Singleton for the Internationalization (I18N)

 [1] HOWTO TRANSLATE JUMP IN MY OWN LANGUAGE
  Copy theses files and add the locales extension for your language and country instead of the *.
  - resources/jump_*.properties
  - com/vividsolutions/jump/workbench/ui/plugin/KeyboardPlugIn_*.html
 [2] HOWTO TRANSLATE MY PLUGIN AND GIVE THE ABILITY TO TRANSLATE IT
  Use theses methods to use your own *.properties files :
  [Michael Michaud 2007-03-23] the 3 following methods have been deactivated
  com.vividsolutions.jump.I18N#setPlugInRessource(String, String)
  com.vividsolutions.jump.I18N#get(String, String)
  com.vividsolutions.jump.I18N#getMessage(String, String, Object[])
  you still can use plugInsResourceBundle (as in Pirol's plugin)
  
  And use jump standard menus
 
Code example : [Michael Michaud 2007-03-23 : the following code example is no more valid and has to be changed]
 public class PrintPlugIn extends AbstractPlugIn
  {
    private String name = "print";
 public void initialize(PlugInContext context) throws Exception
 {
   I18N.setPlugInRessource(name, "org.agil.core.jump.plugin.print");
   context.getFeatureInstaller().addMainMenuItem(this,
                                                 new String[]
                                                 {MenuNames.TOOLS,I18N.get(name, "print")},
                                                 I18N.get(name, "print"), false, null, null);
 }
 ...
 
 TODO :I18N (1) Improve translations
 TODO :I18N (2) Separate config (customization) and I18N
 TODO :I18N (3) Explore and discuss about I18N integration and Jakarta Common Ressources
 (using it as a ressource interface)
 

Author:
Basile Chandesris -
See Also:
MenuNames, text rotation

Field Summary
static java.util.Hashtable plugInsResourceBundle
           
static java.util.ResourceBundle rb
           
 
Method Summary
static java.lang.String get(java.lang.String label)
          Process text with the locale 'jump_.properties' file
static I18N getInstance()
           
static I18N getInstance(java.lang.String category)
          Get the I18N instance for the category.
static java.lang.String getLanguage()
          Get the short signature for language (letters extension :language 2 letters)
static java.lang.String getLocale()
          Get the short signature for locale (letters extension :language 2 letters + "_" + country 2 letters)
static java.lang.String getMessage(java.lang.String label, java.lang.Object[] objects)
          Process text with the locale 'jump_.properties' file If no resourcebundle is found, returns default string contained inside com.vividsolutions.jump.jump
static java.lang.String getMessage(java.lang.String category, java.lang.String label, java.lang.Object[] objects)
          Get the I18N text from the language file associated with the specified category.
 java.lang.String getText(java.lang.String key)
          Get the I18N text from the language file associated with this instance.
static java.lang.String getText(java.lang.String category, java.lang.String key)
          Get the I18N text from the language file associated with the specified category.
static void loadFile(java.lang.String langcountry)
          Load file specified in command line (-i18n lang_country) (lang_country :language 2 letters + "_" + country 2 letters) Tries first to extract lang and country, and if only lang is specified, loads the corresponding resource bundle.
static void setClassLoader(java.lang.ClassLoader classLoader)
          Set the class loader used to load resource bundles, must only be called by the plug-in loader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rb

public static java.util.ResourceBundle rb

plugInsResourceBundle

public static java.util.Hashtable plugInsResourceBundle
Method Detail

setClassLoader

public static void setClassLoader(java.lang.ClassLoader classLoader)
Set the class loader used to load resource bundles, must only be called by the plug-in loader.

Parameters:
classLoader - the classLoader to set

getText

public java.lang.String getText(java.lang.String key)
Get the I18N text from the language file associated with this instance. If no label is defined then a default string is created from the last part of the key.

Parameters:
key - The key of the text in the language file.
Returns:
The I18Nized text.

getText

public static java.lang.String getText(java.lang.String category,
                                       java.lang.String key)
Get the I18N text from the language file associated with the specified category. If no label is defined then a default string is created from the last part of the key.

Parameters:
category - The category.
key - The key of the text in the language file.
Returns:
The I18Nized text.

getInstance

public static I18N getInstance(java.lang.String category)
Get the I18N instance for the category. A resource file must exist in the resource path for language/jump for the category.

Parameters:
category - The category.
Returns:
The instance.

getInstance

public static I18N getInstance()

loadFile

public static void loadFile(java.lang.String langcountry)
Load file specified in command line (-i18n lang_country) (lang_country :language 2 letters + "_" + country 2 letters) Tries first to extract lang and country, and if only lang is specified, loads the corresponding resource bundle.

Parameters:
langcountry -

get

public static java.lang.String get(java.lang.String label)
Process text with the locale 'jump_.properties' file

Parameters:
label -
Returns:
i18n label [Michael Michaud 2007-03-23] If no resourcebundle is found, returns a default string which is the last part of the label

getLocale

public static java.lang.String getLocale()
Get the short signature for locale (letters extension :language 2 letters + "_" + country 2 letters)

Returns:
string signature for locale

getLanguage

public static java.lang.String getLanguage()
Get the short signature for language (letters extension :language 2 letters)

Returns:
string signature for language

getMessage

public static java.lang.String getMessage(java.lang.String label,
                                          java.lang.Object[] objects)
Process text with the locale 'jump_.properties' file If no resourcebundle is found, returns default string contained inside com.vividsolutions.jump.jump

Parameters:
label - with argument insertion : {0}
objects -
Returns:
i18n label

getMessage

public static java.lang.String getMessage(java.lang.String category,
                                          java.lang.String label,
                                          java.lang.Object[] objects)
Get the I18N text from the language file associated with the specified category. If no label is defined then a default string is created from the last part of the key.

Parameters:
category - The category.
label - with argument insertion : {0}
objects -
Returns:
i18n label