Labels

Developers could separate Locale-dependent data from the ZUML pages (and JSP pages) by storing them in i3-label_lang_CNTY.properties under the WEB-INF directory, where lang is the language such as en and fr, and CNTY is the country, such as US and FR.

To get a Locale-dependent property, you could use org.zkoss.util.resource.Labels in Java, or ${c:l('key')} in EL expression. To use it in EL, you have to specify the TLD file with the taglib directive in your page as follows.

<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>

<window title="${c:l('app.title')}">
...
</window>

File Location: core.dsp.tld is distributed under the dist/WEB-INF directory. You do not need to copy it to your Web application.

When a Locale-dependent label is about to retrieved, one of i3-label_lang_CNTY.properties will be loaded. For example, if the Locale is de_DE, then WEB-INF/i3-label_de_DE.properties will be loaded. If no such file, ZK will try to load WEB-INF/i3-label_de.properties and WEB-INF/i3-label.properties in turn.

To access labels in Java codes (including zscript), use the getLabel method of the org.zkoss.util.resource.Labels class.

In addition, you could extend the label loader to load labels from other locations, say database, by registering a locator, which must implement the org.zkoss.util.resource.LabelLocator interface. Then, invoke the register method of the org.zkoss.util.resource.Labels class.