Warning and Error Messages"

From Documentation
Line 22: Line 22:
  
 
where 3000 is the error code and you can find it at [[ZK Messages]]
 
where 3000 is the error code and you can find it at [[ZK Messages]]
 +
 +
For messages defined in msgzk.js/msgzul.js you can add it to a js file and include it via lang-addon.xml. For example for overriding msgzk.LOADING for CEZH language create a file test_cs.js and override particular message <code>msgzk.LOADING=CS langauge specific message"</code> and include this js file via lang-addon.xml as below
 +
<source lang="xml">
 +
<language-addon>
 +
  <addon-name>test</addon-name>
 +
  <language-name>xul/html</language-name>
 +
 +
  <javascript src="/js/test*.js" />
 +
</language-addon>
 +
</source>
 +
 +
Note: You can use any prefix other than "test" and add language specific suffix to your js files and include all of them by using * wild card as shown above
 +
 +
Finally include your lang-addon.xml in zk.xml using language-config element as shown below
 +
<source lang="xml">
 +
<language-config>
 +
    <addon-uri>/WEB-INF/lang-addon.xml</addon-uri>
 +
</language-config>
 +
</source>
  
 
=Version History=
 
=Version History=

Revision as of 02:41, 17 September 2012


Warning and Error Messages


Overview

ZK's messages (such as warnings and errors) are packed in property files (*.properties) under the /metainfo/mesg directory of the classpath. These mesages are grouped into modules, such as zcommon, zweb, zk and zul. These files are Locale depedent. For example, the message file of zk.jar for Germany messages is msgzk_de_DN.properties or msgzk_de.properties.

Translate messages to another language

If you want to translate messages to another language, you can add your own property files named with the correct Locale, and put it to the /metainfo/mesg directory of the classpath. Of course, it is always better to contribute it back. Please take a look at ZK Messages for all available translations. If you'd like to contribute, just add the language to it and notice us at info at zkoss dot org.

Change particular message

[since 6.0.0]

If you want to change a particular message, you can add it to zk-label.properties. For example, let us see you want to customize MZk.NOT_FOUND in German translation, then you can add the following to WEB-INF/zk-label_de.properties:

MZk.3000=my customized message here

where 3000 is the error code and you can find it at ZK Messages

For messages defined in msgzk.js/msgzul.js you can add it to a js file and include it via lang-addon.xml. For example for overriding msgzk.LOADING for CEZH language create a file test_cs.js and override particular message msgzk.LOADING=CS langauge specific message" and include this js file via lang-addon.xml as below

<language-addon>
  <addon-name>test</addon-name>
  <language-name>xul/html</language-name>

  <javascript src="/js/test*.js" />
</language-addon>

Note: You can use any prefix other than "test" and add language specific suffix to your js files and include all of them by using * wild card as shown above

Finally include your lang-addon.xml in zk.xml using language-config element as shown below

<language-config>
    <addon-uri>/WEB-INF/lang-addon.xml</addon-uri>
</language-config>

Version History

Last Update : 2012/09/17


Version Date Content
6.0.0 n/a Allows applications to override a particular message with zk-label.



Last Update : 2012/09/17

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