public final class I18N
extends java.lang.Object
[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 menusCode 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)
MenuNames
,
text rotation
Modifier and Type | Field and Description |
---|---|
static java.util.Hashtable |
plugInsResourceBundle |
Modifier and Type | Method and Description |
---|---|
static void |
applyToRuntime(java.util.Locale loc)
Applies a given locale to the java runtime.
|
static java.util.Locale |
fromCode(java.lang.String localeCode) |
static java.lang.String |
get(java.lang.String label)
Process text with the locale 'jump_
|
static java.lang.String |
getCountry()
Get the short signature for country (2 letter code) of the default instance
|
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) of the default instance
|
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 object) |
static java.lang.String |
getMessage(java.lang.String label,
java.lang.Object[] objects)
Process text with the locale '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 |
setClassLoader(java.lang.ClassLoader cl)
Set the class loader used to load resource bundles, must be called by the
PlugInManager (plugin jars are added to a child classloader there) to allow
plugins to make use of this I18N class.
|
static void |
setLocale(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.
|
public java.lang.String getText(java.lang.String key)
key
- The key of the text in the language file.public static void setClassLoader(java.lang.ClassLoader cl)
cl
- the classLoader to setpublic static java.lang.String getText(java.lang.String category, java.lang.String key)
category
- The category.key
- The key of the text in the language file.public static I18N getInstance(java.lang.String category)
category
- The category.public static I18N getInstance()
public static java.util.Locale fromCode(java.lang.String localeCode)
public static void setLocale(java.lang.String langcountry)
langcountry
- public static void applyToRuntime(java.util.Locale loc)
loc
- public static java.lang.String get(java.lang.String label)
label
- public static java.lang.String getLocale()
public static java.lang.String getLanguage()
public static java.lang.String getCountry()
public static java.lang.String getMessage(java.lang.String label, java.lang.Object[] objects)
label
- with argument insertion : {0}objects
- public static java.lang.String getMessage(java.lang.String label, java.lang.Object object)
public static java.lang.String getMessage(java.lang.String category, java.lang.String label, java.lang.Object[] objects)
category
- The category.label
- Label with argument insertion : {0}objects
-