Package net.sf.jaxodraw.plugin
Interface JaxoPluginDictionary
-
public interface JaxoPluginDictionaryA wrapper of JaxoDictionary for plugins.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Stringlabel(java.lang.String key)Translate 'key' as a label (typically, by appending ": " to the default translation).java.lang.Stringmessage(java.lang.String key, java.lang.Object argument)Translates the given string into the current default language, interpolating a single argument.java.lang.Stringmessage(java.lang.String key, java.lang.Object[] arguments)Translates the given string into the current default language, interpolating arguments.java.lang.Stringmessage(java.lang.String key, java.lang.Object argument1, java.lang.Object argument2)Translates the given string into the current default language, interpolating two arguments.java.lang.Stringtranslate(java.lang.String key)Translates the given string into the current default language.
-
-
-
Method Detail
-
label
java.lang.String label(java.lang.String key)
Translate 'key' as a label (typically, by appending ": " to the default translation).- Parameters:
key- The key to translate.- Returns:
- The translation.
-
translate
java.lang.String translate(java.lang.String key)
Translates the given string into the current default language.- Parameters:
key- The key to translate.- Returns:
- The translated string, or an empty string if key itself is empty.
-
message
java.lang.String message(java.lang.String key, java.lang.Object argument)Translates the given string into the current default language, interpolating a single argument. Equivalent tomessage(String,Object[])with second argumentnew Object[] {argument}.- Parameters:
key- The key to translate.argument- An object.- Returns:
- The translated string.
-
message
java.lang.String message(java.lang.String key, java.lang.Object argument1, java.lang.Object argument2)Translates the given string into the current default language, interpolating two arguments. Equivalent tomessage(String,Object[])with second argumentnew Object[] {argument1, argument2}.- Parameters:
key- The key to translate.argument1- A first object.argument2- A second object.- Returns:
- The translated string.
-
message
java.lang.String message(java.lang.String key, java.lang.Object[] arguments)Translates the given string into the current default language, interpolating arguments.If
argumentsis not empty, the translation ofkeyis used as aMessageFormatpattern, theargumentsarray is then used as the argument forFormat.format(Object).See the language.properties for notes on the parsing of MessageFormat patterns.
If however,
argumentsis empty, the key translation is not parsed as MessageFormat pattern (that way, themessagemethods can be used generically.)By convention, the keys for MessageFormat pattern (and only them) contain percentage signs, followed by a number (starting from zero, as MessageFormat), to denote the occurrence of arguments (e.g.
JaxoIO.read%0ReadFailed=File "{0}" could not be read.). Then:- In the properties file, it is clear from the key whether the value is a MessageFormat pattern or a plain String.
- In the java source, one can see whether the actual number of arguments
matches the expected one (e.g.
message("JaxoIO.read%0ReadFailed", new Object[] { a, b});can be seen to be incorrect.
- Parameters:
key- The key to translate.arguments- An array of objects (arguments for MessageFormat).- Returns:
- The translated string.
-
-