l2"

From Documentation
(Created page with "{{ZUMLReferencePageHeader}} <source lang="java"> String l(String key); </source> :i.e., <javadoc method="getLabel(java.lang.String)">org.zkoss.xel.fn.CommonFns</javadoc> Retur...")
 
m
Line 2: Line 2:
  
 
<source lang="java">
 
<source lang="java">
String l(String key);
+
String l2(String key, Object[] args);
 
</source>
 
</source>
  
:i.e., <javadoc method="getLabel(java.lang.String)">org.zkoss.xel.fn.CommonFns</javadoc>
+
:i.e., <javadoc method="getLabel(java.lang.String, java.lang.Object[])">org.zkoss.xel.fn.CommonFns</javadoc>
  
Returns the label of the given key defined in i3-label.properties. The label is based on the current Locale. For more information, please refer to [[ZK Developer's Reference/Internationalization/Labels|ZK Developer's Reference]].
+
Returns the label of the given key defined in [[ZK Developer's Reference/Internationalization/Labels|the internationalization labels]], and formats it with the given arguments. The formating is done by use of [http://download.oracle.com/javase/6/docs/api/java/text/MessageFormat.html MessageFormat].
 +
 
 +
The label is based on the current Locale (<javadoc method="currentLocale">org.zkoss.util.Locales</javadoc>).
 +
 
 +
For example, let us assume we want to generate a full name based on the current Locale, then we could use <tt>${c:l2('key',args)}</tt> to generate concatenated messages as follows.
 +
 
 +
<source lang="xml" >
 +
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
 +
<label value="${c:l2('fullname.format', fullname)}">
 +
</source>
 +
 
 +
where we assume fullname is a string array (such as <code>new String[] {"Jimmy", "Shiau"}</code>).
  
 
=Version History=
 
=Version History=

Revision as of 02:37, 28 March 2011

String l2(String key, Object[] args);
i.e., CommonFns.getLabel(String, Object[])

Returns the label of the given key defined in the internationalization labels, and formats it with the given arguments. The formating is done by use of MessageFormat.

The label is based on the current Locale (Locales.currentLocale).

For example, let us assume we want to generate a full name based on the current Locale, then we could use ${c:l2('key',args)} to generate concatenated messages as follows.

<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
<label value="${c:l2('fullname.format', fullname)}">

where we assume fullname is a string array (such as new String[] {"Jimmy", "Shiau"}).

Version History

Last Update : 2011/03/28


Version Date Content
     



Last Update : 2011/03/28

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.