|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.jaxodraw.util.JaxoDictionary
public class JaxoDictionary
Translation using JaxoLanguage within a given context (bundleID and/or prefix for the keys). All methods call eventually into JaxoLanguage.
Constructor Summary | |
---|---|
JaxoDictionary(Class<?> c)
Create for the given class. |
Method Summary | |
---|---|
String |
label(String key)
Translate 'key' as a label (typically, by appending ": " to the default translation). |
Locale |
locale()
Locale corresponding to the current language. |
String |
message(String key,
Object argument)
Translates the given string into the current default language, interpolating a single argument. |
String |
message(String key,
Object[] arguments)
Translates the given string into the current default language, interpolating arguments. |
String |
message(String key,
Object argument1,
Object argument2)
Translates the given string into the current default language, interpolating two arguments. |
String |
value(String key)
Translates the given string into the current default language. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JaxoDictionary(Class<?> c)
c
- The class to register.Method Detail |
---|
public Locale locale()
public String label(String key)
key
- The key to translate.
public String value(String key)
key
- The key to translate.
public String message(String key, Object argument)
message(String,Object[])
with second argument
new Object[] { argument }
.
key
- The key to translate.argument
- An object.
public String message(String key, Object argument1, Object argument2)
message(String,Object[])
with second argument
new Object[] { argument1, argument2 }
.
key
- The key to translate.argument1
- A first object.argument2
- A second object.
public String message(String key, Object[] arguments)
If arguments
is not empty, the translation of
key
is used as a
MessageFormat
pattern, the arguments
array is then used as the argument for
Format.format(Object)
.
See the language.properties for notes on the parsing of MessageFormat patterns.
If however, arguments
is empty, the key
translation is not parsed as MessageFormat pattern (That way, the
message
methods 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:
message("JaxoIO.read%0ReadFailed", new Object[] { a, b});
can be seen to be incorrect.
key
- The key to translate.arguments
- An array of objects (arguments for MessageFormat).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |