| java.lang.Object org.zkoss.text.MessageFormats
MessageFormats | public class MessageFormats (Code) | | The message formatting relevant utilities.
See also java.text.MessageFormat.
author: tomyeh |
Inner Class :public static class NameInfo | |
Method Summary | |
final public static String | format(String pattern, Object[] args, Locale locale) Creates a MessageFormat with the given pattern and uses it to
format the given arguments. | final public static String | format(String pattern, Object[] args) Creates a MessageFormat with the given pattern and uses it to
format the given arguments, by use of
Locales.getCurrent . | final public static StringBuffer | format(StringBuffer result, String pattern, Object[] args, Locale locale) Creates a MessageFormat with the given pattern and uses it to
format the given arguments, by use of StringBuffer. | final public static StringBuffer | format(StringBuffer result, String pattern, Object[] args) Creates a MessageFormat with the given pattern and uses it to
format the given arguments, by use of StringBuffer and
Locales.getCurrent . | final public static String | formatByName(String pattern, Map mapping, Locale locale) Formats a pattern by substituting names, enclosing with {}, with
values found in the giving map.
This is an extension to java.text.MessageFormat.
The only difference is that this method use arbitrary name
instead of a number. | final public static String | formatByName(String pattern, Map mapping) Formats a pattern by substituting names with values found in
the giving map, by use of
Locales.getCurrent . | final public static NameInfo | parseByName(String pattern) Parses a pattern and converts it to the format of
java.text.MessageFormat. |
format | final public static String format(String pattern, Object[] args, Locale locale)(Code) | | Creates a MessageFormat with the given pattern and uses it to
format the given arguments.
An extension to java.text.MessageFormat.format by allowing
to specify a Locale.
Parameters: locale - the locale; null for Locales.getCurrent |
format | final public static String format(String pattern, Object[] args)(Code) | | Creates a MessageFormat with the given pattern and uses it to
format the given arguments, by use of
Locales.getCurrent .
Note: java.text.MessageFormat.format uses Locale.getDefault,
which might not be corrent in a multi-user environment.
|
format | final public static StringBuffer format(StringBuffer result, String pattern, Object[] args, Locale locale)(Code) | | Creates a MessageFormat with the given pattern and uses it to
format the given arguments, by use of StringBuffer.
If you want to catenate a sequence of formated string, use
this method.
|
formatByName | final public static String formatByName(String pattern, Map mapping, Locale locale)(Code) | | Formats a pattern by substituting names, enclosing with {}, with
values found in the giving map.
This is an extension to java.text.MessageFormat.
The only difference is that this method use arbitrary name
instead of a number. For example, it use {name} instead of {0}.
The quotation rule and formating pattern are the same as
java.text.MessageFormat. Example, {var,number,$'#',###}.
It actually uses
MessageFormats.parseByName to convert names to numbers,
and then passes to java.text.MessageFormat.
Parameters: locale - the locale; null forLocales.getCurrent exception: IllegalArgumentException - if the pattern is invalid See Also: MessageFormats.parseByName |
parseByName | final public static NameInfo parseByName(String pattern)(Code) | | Parses a pattern and converts it to the format of
java.text.MessageFormat.
Names are the first element of a substring enclosing with {}
in the pattern.
Example: "{a} is {b,number} of {a}" will return
new NameInfo("{0} is {1,number} of {0}", {"a", "b"}) .
See Also: MessageFormats.formatByName(String,Map,Locale) |
|
|