Language Definition"

From Documentation
m
 
(12 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
{{ZKClient-sideReferencePageHeader}}
 
{{ZKClient-sideReferencePageHeader}}
  
<blockquote>
+
__TOC__
----
+
 
This section describes what a language definition and addon are. It is required for the component component. However, you could skip it if you won't develop components. For more information about component development, please refer to [[ZK Component Development Essentials]].
+
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 an ZK application, please refer to [[ZK Developer's Reference/Customization/Packing Code|ZK Developer's Reference: Packing Code]].
+
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]].
</blockquote>
+
 
 +
 
 +
 
 +
= Language Definition=
  
 
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.
 
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.
  
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 additions, you could specify them in [[ZK Configuration Reference/JAR File's config.xml/The language-config Element|/metainfo/zk/config.xml]] in the classpath.
+
To define a language definition, you have to prepare a file called <code>/metainfo/zk/lang.xml</code> and make 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. (parsed by org.zkoss.zk.ui.metainfo.DefinitionLoaders)
 +
 
 +
= Language Addon =
 +
 
 +
A language addon serves to extend a language definition within the ZK framework. You can include a language addon using any of the following methods:
 +
 
 +
== Path Convention Loading ==
 +
* '''In a web application (WAR):''' Ensure that the file is named '''lang-addon.xml'''. Put the file at
 +
<code>/WEB-INF/classes/metainfo/zk/lang-addon.xml</code>.
 +
 
 +
This location makes the file accessible to the classpath.
 +
* '''In a jar file:''' Put the file at
 +
<code>mymodule.jar/metainfo/zk/lang-addon.xml</code>.
 +
 
 +
== zk.xml ==
 +
Specify the file path using the <code>&lt;language-config&gt;</code> element in '''zk.xml'''. This method allows you to use any file name for the configuration file. Learn more about this configuration at [[ZK_Configuration_Reference/zk.xml/The_language-config_Element|&lt;language-config&gt; in zk.xml]].
 +
 
 +
== config.xml ==
 +
For JAR files, specify the file path in the configuration file located at <code>/metainfo/zk/config.xml</code>. This approach is useful when the configuration file needs to be included in the classpath. Further details can be found at [[ZK Configuration Reference/JAR File's config.xml/The language-config Element|/metainfo/zk/config.xml]].
 +
 
 +
 
 +
These methods provide flexible options for integrating language addons, ensuring they are properly recognized and utilized by the ZK framework.
 +
 
 +
 
  
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, specified in [[ZK_Configuration_Reference/zk.xml/The_language-config_Element|WEB-INF/zk.xml]] (in a Web application), or specified in [[ZK Configuration Reference/JAR File's config.xml/The language-config Element|/metainfo/zk.config.xml]] (in a JAR file; classpath).
+
When ZK starts, it will parse all language definitions and then all language add-ons 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 for the naming and it must specify the [[ZK Client-side Reference/Language Definition/addon-name|<addon-name>]].
  
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]].
+
{{DoctypeDisallowed}}
  
 
{{ZKClient-sideReferenceHeadingToc}}
 
{{ZKClient-sideReferenceHeadingToc}}
 
{{ZKClient-sideReferencePageFooter}}
 
{{ZKClient-sideReferencePageFooter}}

Latest revision as of 08:21, 17 October 2024


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 make 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. (parsed by org.zkoss.zk.ui.metainfo.DefinitionLoaders)

Language Addon

A language addon serves to extend a language definition within the ZK framework. You can include a language addon using any of the following methods:

Path Convention Loading

  • In a web application (WAR): Ensure that the file is named lang-addon.xml. Put the file at

/WEB-INF/classes/metainfo/zk/lang-addon.xml.

This location makes the file accessible to the classpath.

  • In a jar file: Put the file at

mymodule.jar/metainfo/zk/lang-addon.xml.

zk.xml

Specify the file path using the <language-config> element in zk.xml. This method allows you to use any file name for the configuration file. Learn more about this configuration at <language-config> in zk.xml.

config.xml

For JAR files, specify the file path in the configuration file located at /metainfo/zk/config.xml. This approach is useful when the configuration file needs to be included in the classpath. Further details can be found at /metainfo/zk/config.xml.


These methods provide flexible options for integrating language addons, ensuring they are properly recognized and utilized by the ZK framework.


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

DOCTYPE restriction

Since 10.0.0

Starting from ZK 10, the xml parser used by ZK declares disallow-doctype-decl to true. This prevents the use of DOCTYPE declaration in xml files, such as zk.xml, lang-addon.xml, config. xml, etc. This is a security measure to prevent XXE attacks using <!DOCTYPE ...> as vector.




Last Update : 2024/10/17

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