The language definition is a XML file definition a new language, which includes component definitions and other language features.
The syntax of the language definition is similar to the language addon except the location and the headers are a bit different.
The language definition must be named lang.xml and placed at the /metainfo/zk directory accessible by the classpath.
[Required]
<language-name>xul/html</language-name>
Specified the language name that uniquely identifies this langauge.
[Required]
<<device-type>ajax</device-type>
Specified the device type, such as ajax, xml, mil and hil.
[Required]
<namespace>http://www.zkoss.org/2005/zul</namespace>
Specified the namespace that also uniquely identifies this language.
[Required; Multiple]
<extension>zul</extension> <extension>xul</extension>
Specified the file extension that shall be considered as using this language. For example, if zul is specified, this language will be used as the default language for all files with the .zul extension. Of course, the file can change the language later with the page directive.
[Optional[18]]
<version> <version-class>org.zkoss.zul.Version</version-class> <version-uid>3.0.5</version-uid> <zk-version>3.0.0</zk-version><!-- or later → </version>
There are two parts: language version and ZK version. Language version is specified in version-uid element. In certain environments, it is possible to have several versions of JAR file containing the same set of component definitions[19]. To ensure the correct XML file is loaded, you have to specify a class carrying the version. The class must have a static data member called UID as shown below.
public class Version {
public static final String UID = "3.0.5";
}
Then, ZK will compare UID with the value specified in version-uid, and the language is ignored if not matched – it means the XML file is not from the same JAR file being loaded.
ZK Version that this language requires is specified in the zk-version element. The language is ignored if ZK installed is an older version.