0

Example of interface localization

asked 2008-08-09 13:07:28 +0800

Vic gravatar image Vic
54

Could somebody provide me with a clear example of localization lables in zul page.
I have property files: net.app.texts.properties, net.app.texts_uk.properties, etc.
with texts:
windowMain.questionnaire_tooltiptext=Questionnaire
windowMain.exit_tooltiptext=Exit
.....

how to use these in zul page element?
<button tooltiptext="???" />

delete flag offensive retag edit

6 Replies

Sort by ยป oldest newest

answered 2008-08-11 04:30:00 +0800

dennis gravatar image dennis
3669 1 6
http://www.javaworld.com....

check this default i18n implementation.
http://www.zkoss.org/doc/devguide/ch13.html

link publish delete flag offensive edit

answered 2008-08-11 08:52:15 +0800

Vic gravatar image Vic
54

updated 2008-08-11 08:52:55 +0800

Thank you, but I spent about 4h for this article and didn't get any result.

I think it has to be 2-3 lines in zul page for get acces to my bundle *.properties files. But I dont know how to read properties files in ZUL, I see only reading TLD files...
When I try to read properties file, i get error:
org.zkoss.lang.SystemException: org.xml.sax.SAXParseException: Content is not allowed in prolog.

link publish delete flag offensive edit

answered 2008-08-11 10:43:41 +0800

robertlee gravatar image robertlee
561

I think your problem is in your properties file, perhaps?

See this link

link publish delete flag offensive edit

answered 2008-08-11 15:36:39 +0800

Vic gravatar image Vic
54

Ok I write my questions in other manner
1) What format of property files ZK use (properties or XML)?
2) Where I have to save my properties files (under /WEB-INF or classes directories)?
3) Where I have to write name and path for my properties files on ZUL page?
In documentation I don't see answers... so I ask any example.

link publish delete flag offensive edit

answered 2008-08-11 16:19:40 +0800

sousa1981 gravatar image sousa1981
573 4

Search the forum you will found answers.

1) properties
2) In \WEB-INF\i3-label.properties + \WEB-INF\i3-label_pt_PT.properties + etc
3) What about an zul example:

<?xml version="1.0" encoding="utf-8"?>
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c" ?>
<?evaluator name="mvel"?>
<?page title=".:: VIC ::."?>

<window width="99%" 
	xmlns:zk="http://www.zkoss.org/2005/zul"
	xmlns:n="http://www.zkoss.org/2005/zk/native"
	xmlns:h="http://www.w3.org/1999/xhtml" 	
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd">
	
	<zk:label value="${Labels.getLabel('username')}:" />

</window>

I am using MVEL so you will need MVEL jar in your classpath.

What about in java source code:
import org.zkoss.util.resource.Labels;

Labels.getLabel("username");

BONUS: You could use properties like copyright.year=2005-2008

Hope it helped you.

link publish delete flag offensive edit

answered 2008-08-11 21:54:40 +0800

Vic gravatar image Vic
54

updated 2008-08-11 21:55:53 +0800

Very nice ! Thank you, sousa1981

1) I put "i3-label_*_*.properties" files in WEB-INF.
2) I used next code in zul page:

<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c" ?>
<button tooltiptext="${c:l('windowMain.questionnaire_tooltiptext')}" />

All work perfect !

Also I tryed use MVEL, as you write above

<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c" ?>
<?evaluator name="mvel"?>
<button tooltiptext="${Labels.getLabel('windowMain.questionnaire_tooltiptext')}" />

It works too.

You helped me, thank you very much !

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2008-08-09 13:07:28 +0800

Seen: 536 times

Last updated: Aug 11 '08

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More