|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.samskivert.text.MessageUtil
public class MessageUtil
Utility functions for translation string handling.
| Field Summary | |
|---|---|
static String |
QUAL_PREFIX
Used to mark fully qualified message keys. |
static String |
QUAL_SEP
Used to separate the bundle qualifier from the message key in a fully qualified message key. |
static String |
TAINT_CHAR
Text prefixed by this character will be considered tainted when doing recursive translations and won't be translated. |
| Constructor Summary | |
|---|---|
MessageUtil()
|
|
| Method Summary | |
|---|---|
static String |
compose(String key,
Object... args)
Composes a message key with an array of arguments. |
static String |
compose(String key,
String... args)
Compose a message with String args. |
static String[] |
decompose(String compoundKey)
Decomposes a compound key into its constituent parts. |
static String |
escape(String message)
Used to escape single quotes so that they are not interpreted by MessageFormat. |
static String |
getBundle(String qualifiedKey)
Returns the bundle name from a fully qualified message key. |
static String |
getUnqualifiedKey(String qualifiedKey)
Returns the unqualified portion of the key from a fully qualified message key. |
static String |
qualify(String bundle,
String key)
Returns a fully qualified message key which, when translated by some other bundle, will know to resolve and utilize the supplied bundle to translate this particular key. |
static String |
taint(Object text)
Call this to "taint" any string that has been entered by an entity outside the application so that the translation code knows not to attempt to translate this string when doing recursive translations. |
static String |
tcompose(String key,
Object... args)
A convenience method for calling compose(String,Object[])
with an array of arguments that will be automatically tainted (see
taint(java.lang.Object)). |
static String |
tcompose(String key,
String... args)
A convenience method for calling compose(String,String[])
with an array of argument that will be automatically tainted. |
static String |
unescape(String value)
Unescapes characters that are escaped in a call to compose. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String TAINT_CHAR
public static final String QUAL_PREFIX
public static final String QUAL_SEP
| Constructor Detail |
|---|
public MessageUtil()
| Method Detail |
|---|
public static String taint(Object text)
public static String compose(String key,
Object... args)
public static String compose(String key,
String... args)
public static String escape(String message)
MessageFormat. As we assume all single quotes are to be
escaped, we cannot use the characters { and
} in our translation strings, but this is a small
price to pay to have to differentiate between messages that will
and won't eventually be parsed by a MessageFormat instance.
public static String unescape(String value)
public static String tcompose(String key,
Object... args)
compose(String,Object[])
with an array of arguments that will be automatically tainted (see
taint(java.lang.Object)).
public static String tcompose(String key,
String... args)
compose(String,String[])
with an array of argument that will be automatically tainted.
public static String[] decompose(String compoundKey)
public static String qualify(String bundle,
String key)
public static String getBundle(String qualifiedKey)
qualify(java.lang.String, java.lang.String)public static String getUnqualifiedKey(String qualifiedKey)
qualify(java.lang.String, java.lang.String)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||