l2"

From Documentation
m
m (correct highlight (via JWB))
 
(One intermediate revision by one other user not shown)
Line 7: Line 7:
 
:i.e., <javadoc method="getLabel(java.lang.String, java.lang.Object[])">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 [[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].
+
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 formatting is done by the 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="getCurrent()">org.zkoss.util.Locales</javadoc>).
 
The label is based on the current Locale (<javadoc method="getCurrent()">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.
+
For example, let us assume we want to generate a full name based on the current Locale, then we could use <code>${c:l2('key',args)}</code> to generate concatenated messages as follows.
  
 
<source lang="xml" >
 
<source lang="xml" >

Latest revision as of 13:26, 19 January 2022

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 formatting is done by the use of MessageFormat.

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

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 : 2022/01/19


Version Date Content
     



Last Update : 2022/01/19

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