|
||||||||||
| 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 buoy.widget.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. |
static buoy.widget.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. |
static buoy.widget.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. |
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 buoy.widget.BLabel |
label(java.lang.String name)
Get a BLabel whose text is given by the property "name". |
static buoy.widget.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 buoy.widget.BMenu |
menu(java.lang.String name)
Get a BMenu whose text is given by the property "menu. |
static buoy.widget.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. |
static buoy.widget.BMenuItem |
menuItem(java.lang.String name,
java.lang.Object listener,
java.lang.String method,
buoy.widget.Shortcut shortcut)
Get a BMenuItem whose text is given by the property "menu. |
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 buoy.widget.BMenu menu(java.lang.String name)
public static buoy.widget.BMenuItem menuItem(java.lang.String name,
java.lang.Object listener,
java.lang.String method)
public static buoy.widget.BMenuItem menuItem(java.lang.String name,
java.lang.Object listener,
java.lang.String method,
buoy.widget.Shortcut shortcut)
public static buoy.widget.BCheckBoxMenuItem checkboxMenuItem(java.lang.String name,
java.lang.Object listener,
java.lang.String method,
boolean state)
public static buoy.widget.BButton button(java.lang.String name,
java.lang.Object listener,
java.lang.String method)
public static buoy.widget.BButton button(java.lang.String name,
java.lang.String suffix,
java.lang.Object listener,
java.lang.String method)
public static buoy.widget.BLabel label(java.lang.String name)
public static buoy.widget.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 | |||||||||