|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectartofillusion.ui.Translate
public class Translate
This class provides utilities for localizing text so that it can be translated into different languages. It does this by loading strings from a resource bundle, and using them to create properly localized widgets.
The resource bundle is created from a PluginResource
of type "TranslateBundle" provided by the PluginRegistry
.
By default it uses the PluginResource with ID "artofillusion" which is built into the application,
but you can specify a
different one by prefixing its ID to the property name passed to any method of this class.
This allows plugins to provide their own ResourceBundles for localizing their strings. To do
this, the plugin should include a set of properties files that define the localized versions
of its strings, such as:
com/mycompany/myplugin.properties
com/mycompany/myplugin_fr.properties
com/mycompany/myplugin_es.properties
In its extensions.xml file, it then provides a reference to these files:
<resource type="TranslateBundle" id="myplugin" name="com.mycompany.myplugin"/>
To look up keys from that bundle, prefix the key with the ID specified in the <resource> tag:
BLabel instructions = Translate.label("myplugin:instructionsLabel");
Constructor Summary | |
---|---|
Translate()
|
Method Summary | |
---|---|
static BButton |
button(java.lang.String name,
java.lang.Object listener,
java.lang.String method)
Get a BButton whose text is given by the property "button.(name)". |
static BButton |
button(java.lang.String name,
java.lang.String suffix,
java.lang.Object listener,
java.lang.String method)
Get a BButton whose text is given by the property "button.(name)", with a suffix appended to it. |
static BCheckBoxMenuItem |
checkboxMenuItem(java.lang.String name,
java.lang.Object listener,
java.lang.String method,
boolean state)
Get a BCheckBoxMenuItem whose text is given by the property "menu.(name)". |
static java.util.Locale[] |
getAvailableLocales()
Get a list of the locales for which we have translations. |
static java.util.Locale |
getLocale()
Get the locale currently used for generating text. |
static BLabel |
label(java.lang.String name)
Get a BLabel whose text is given by the property "name". |
static BLabel |
label(java.lang.String name,
java.lang.String suffix)
Get a BLabel whose text is given by the property "name", with a suffix appended to it. |
static BMenu |
menu(java.lang.String name)
Get a BMenu whose text is given by the property "menu.(name)". |
static BMenuItem |
menuItem(java.lang.String name,
java.lang.Object listener,
java.lang.String method)
Get a BMenuItem whose text is given by the property "menu.(name)". |
static BMenuItem |
menuItem(java.lang.String name,
java.lang.Object listener,
java.lang.String method,
Shortcut shortcut)
Get a BMenuItem whose text is given by the property "menu.(name)". |
static void |
setLocale(java.util.Locale l)
Set the locale to be used for generating text. |
static java.lang.String |
text(java.lang.String name)
Get the text given by the property "name". |
static java.lang.String |
text(java.lang.String name,
java.lang.Object arg1)
Get the text given by the property "name". |
static java.lang.String |
text(java.lang.String name,
java.lang.Object[] args)
Get the text given by the property "name". |
static java.lang.String |
text(java.lang.String name,
java.lang.Object arg1,
java.lang.Object arg2)
Get the text given by the property "name". |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Translate()
Method Detail |
---|
public static void setLocale(java.util.Locale l)
public static java.util.Locale getLocale()
public static java.util.Locale[] getAvailableLocales()
public static BMenu menu(java.lang.String name)
public static BMenuItem menuItem(java.lang.String name, java.lang.Object listener, java.lang.String method)
public static BMenuItem menuItem(java.lang.String name, java.lang.Object listener, java.lang.String method, Shortcut shortcut)
public static BCheckBoxMenuItem checkboxMenuItem(java.lang.String name, java.lang.Object listener, java.lang.String method, boolean state)
public static BButton button(java.lang.String name, java.lang.Object listener, java.lang.String method)
public static BButton button(java.lang.String name, java.lang.String suffix, java.lang.Object listener, java.lang.String method)
public static BLabel label(java.lang.String name)
public static BLabel label(java.lang.String name, java.lang.String suffix)
public static java.lang.String text(java.lang.String name)
public static java.lang.String text(java.lang.String name, java.lang.Object arg1)
public static java.lang.String text(java.lang.String name, java.lang.Object arg1, java.lang.Object arg2)
public static java.lang.String text(java.lang.String name, java.lang.Object[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |