0

need help to create simple internationalization

asked 2010-07-13 04:42:54 +0800

sarszk gravatar image sarszk
102 1 3

hello all,
I need help. I want to create simple internationalization, but I have stuck to display it.
I've created properties file entitled sample.properties, then I put it under WEB-INF directory. Then in zul page, I put some code like this


<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
<zk>
<label value="${c:l('product.productname')}"></label>

</zk>

for sample.properties, I put this code
'product.productname = Product Name

But, it doesn't display anything :(, please help
Thanks

delete flag offensive retag edit

10 Replies

Sort by ยป oldest newest

answered 2010-07-13 05:46:14 +0800

juminrubin gravatar image juminrubin
36

Hi Sarszk,

The properties file must be named i3-labels.properties. Please refer to the ZK Developer Guide in Chapter 14.

Cheers,

link publish delete flag offensive edit

answered 2010-07-13 22:19:18 +0800

sarszk gravatar image sarszk
102 1 3

Hi Juminrubin,
Thanks for response. But I need to make the file properties in other name. Because I want to distinguish each properties needs. Thanks for help

link publish delete flag offensive edit

answered 2010-07-14 03:27:47 +0800

vinhvo gravatar image vinhvo
369 3

Use

include = colors.properties
include = sizes.properties
in i3-labels.properties to include another property files if you have the need to use various file names

link publish delete flag offensive edit

answered 2010-07-14 04:05:08 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2010-07-14 04:08:54 +0800

Hi vinhvo,

do you know if its possible to seperate translated i3_labels.properties file?
Means that i can application independend used translations put in an other properties file like:

i3-labels.properties (holds app specific value pairs for english language as default)
system.properties (holds system specific value pairs for english language as default)

i3-labels_de_DE.properties (holds app specific value pairs for german language as default)
system_de_DE.properties (holds system specific value pairs for german language as default)

thanks
Stephan

link publish delete flag offensive edit

answered 2010-07-14 04:10:57 +0800

sarszk gravatar image sarszk
102 1 3

Hi Vinhvo and Stephan,

thanks for the solutions. Then I need to ask you all, can I create properties which name is not i3_****?
Or it is must use i3*****
thanks much, sorry to keep asking. :)

link publish delete flag offensive edit

answered 2010-07-14 04:28:30 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2010-07-14 05:03:30 +0800

@vinhvo,

i found it. I asked a silly question. So we do write the include declarations in all i3-labels_xx_XX.properties files the localization mechanism looks in the declared file.

I should include in the followed way:

i3-labels_de_DE.properties (translated)
--> include = system_de_DE.properties
--> include = others_de_DE.properties

i3-labels.properties (default)
--> include = system.properties
--> include = others.properties

How does zk knows about the 'include' key-word? Would this be a new feature in zk 5.0.4 ??

best
Stephan

link publish delete flag offensive edit

answered 2010-07-14 10:13:33 +0800

vinhvo gravatar image vinhvo
369 3

Hi all, initially, I thought it is possible :

 http://commons.apache.org/configuration/howto_properties.html
. However , it seems not. Maybe the best I can think right now is to implement org.zkoss.util.resource.LabelLocator interface and use Labels.register to register it .

link publish delete flag offensive edit

answered 2010-12-10 08:24:39 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

PUSH !!

Are there any news about including language property files in the default files??

I need this feature for let other users build custom modules for my new project, so they need only to include their property language files
instead of adding their translations in the original base files. That's not a good idea, because by removing their modul the must/should search and delete all of their translations.

thanks
Stephan

link publish delete flag offensive edit

answered 2010-12-10 20:09:22 +0800

samchuang gravatar image samchuang
4084 4

updated 2010-12-10 20:10:12 +0800

Hi ~~

currently, zk doesn't support including language property files feature. you can post a feature request.

link publish delete flag offensive edit

answered 2010-12-11 06:31:52 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

Done. thanks samchuang

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: 2010-07-13 04:42:54 +0800

Seen: 337 times

Last updated: Dec 11 '10

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