Language Definition"

From Documentation
(15 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{ZKDevelopersReferencePageHeader}}
+
{{ZKClient-sideReferencePageHeader}}
  
A language definition defines a component set (aka., a language). For example, [[ZUML Reference/ZUML/Languages/ZUL|ZUL]] and [[ZUML Reference/ZUML/Languages/XHTML|XHTML]] are two component sets.
+
__TOC__
  
To define a language definition, you have to prepare a file called <code>/metainfo/zk/lang.xml</code> and makes it available to the classpath (such as in a JAR file, or in WEB-INF/classes of a Web application).
+
This section describes what a language definition and addon are. It is required for component development. However, you could skip it if you won't develop components. For more information about component development, please refer to [[ZK Component Development Essentials]].
  
A language addon is used to extend a language definition. It shall be called <code>/metainfo/zk/lang-addon.xml</code> available to the classpath, or specified in [[ZK_Configuration_Reference/zk.xml/The_language-config_Element|WEB-INF/zk.xml]].
+
If you would like to change the default configuration of a ZK application, please refer to [[ZK Developer's Reference/Customization/Packing Code|ZK Developer's Reference: Packing Code]].
  
When ZK starts, it will parse all language definitions and then all language addons based on their [[ZK Developer's Reference/Language Definition/depends|dependency]]. A language addon is a variant of a language definition. They are almost the same, except the naming and it must specify the [[ZK Developer's Reference/Language Definition/addon-name|addon name]].
 
  
{{ZKDevelopersReferenceHeadingToc}}
 
  
Here is a sample (from ZUL's lang.xml):
+
= Language Definition=
  
<source lang="xml">
+
A language definition defines a component set (aka., a language). For example, [[ZUML Reference/ZUML/Languages/ZUL|ZUL]] and [[ZUML Reference/ZUML/Languages/XHTML|XHTML]] are two component sets.
<language>
 
<language-name>xul/html</language-name>
 
<device-type>ajax</device-type>
 
<namespace>http://www.zkoss.org/2005/zul</namespace>
 
<extension>zul</extension><!-- the first extension is the major one -->
 
<extension>xul</extension>
 
  
<version>
+
To define a language definition, you have to prepare a file called <code>/metainfo/zk/lang.xml</code> and makes it available to the classpath (such as in a JAR file, or in WEB-INF/classes of a Web application). In addition, you could specify them in [[ZK Configuration Reference/JAR File's config.xml/The language-config Element|/metainfo/zk/config.xml]] in the classpath.
<version-class>org.zkoss.zul.Version</version-class>
 
<version-uid>5.0.6</version-uid>
 
</version>
 
  
<javascript package="zk"/>
+
= Language Addon =
<javascript package="zul.lang"/>
+
A language addon is used to extend a language definition. You need to include it in one of the following ways:
<stylesheet href="~./zul/css/zk.wcs" type="text/css"/>
 
  
<renderer-class>org.zkoss.zul.impl.PageRenderer</renderer-class>
+
* create the file under the path: <code>/WEB-INF/classes/metainfo/zk/lang-addon.xml</code> available to the classpath. The filename must be the same as specified.
 +
* specified the file path in [[ZK_Configuration_Reference/zk.xml/The_language-config_Element|WEB-INF/zk.xml]] (in a Web application)
 +
* specified the file path in [[ZK Configuration Reference/JAR File's config.xml/The language-config Element|/metainfo/zk/config.xml]] (in a JAR file; classpath).
  
<label-template>
 
<component-name>label</component-name>
 
<component-attribute>value</component-attribute>
 
</label-template>
 
<macro-template>
 
<macro-class>org.zkoss.zk.ui.HtmlMacroComponent</macro-class>
 
</macro-template>
 
<native-template>
 
<native-class>org.zkoss.zk.ui.HtmlNativeComponent</native-class>
 
</native-template>
 
  
<component>
+
When ZK starts, it will parse all language definitions and then all language addons based on their [[ZK Client-side Reference/Language Definition/depends|dependency]]. A language addon is a variant of a language definition. They are almost the same, except the naming and it must specify the [[ZK Client-side Reference/Language Definition/addon-name|addon name]].
<component-name>a</component-name>
 
<component-class>org.zkoss.zul.A</component-class>
 
<widget-class>zul.wgt.A</widget-class>
 
<text-as>label</text-as><!-- treat text within the element as the label property -->
 
<mold>
 
<mold-name>default</mold-name>
 
<mold-uri>mold/a.js</mold-uri>
 
<css-uri>css/a.css.dsp</css-uri>
 
</mold>
 
</component>
 
</language>
 
</source>
 
  
{{ZKDevelopersReferencePageFooter}}
+
{{ZKClient-sideReferenceHeadingToc}}
 +
{{ZKClient-sideReferencePageFooter}}

Revision as of 03:19, 27 April 2022


Language Definition



This section describes what a language definition and addon are. It is required for component development. However, you could skip it if you won't develop components. For more information about component development, please refer to ZK Component Development Essentials.

If you would like to change the default configuration of a ZK application, please refer to ZK Developer's Reference: Packing Code.


Language Definition

A language definition defines a component set (aka., a language). For example, ZUL and XHTML are two component sets.

To define a language definition, you have to prepare a file called /metainfo/zk/lang.xml and makes it available to the classpath (such as in a JAR file, or in WEB-INF/classes of a Web application). In addition, you could specify them in /metainfo/zk/config.xml in the classpath.

Language Addon

A language addon is used to extend a language definition. You need to include it in one of the following ways:

  • create the file under the path: /WEB-INF/classes/metainfo/zk/lang-addon.xml available to the classpath. The filename must be the same as specified.
  • specified the file path in WEB-INF/zk.xml (in a Web application)
  • specified the file path in /metainfo/zk/config.xml (in a JAR file; classpath).


When ZK starts, it will parse all language definitions and then all language addons based on their dependency. A language addon is a variant of a language definition. They are almost the same, except the naming and it must specify the addon name.




Last Update : 2022/04/27

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