0

Internationalization Labels with reserved word in key

asked 2020-01-31 21:00:30 +0800

Dmitry3 gravatar image Dmitry3
3 1

We are using Internationalization Labels as described here: ZKDeveloper'sReference/Internationalization/Labels.

When label's key contains reserved word or operator, e.g. "my-super.app.value1" or "mySuper.app.title.new", label's value can not be read with simplest approach suggested, "${labels.my-super.app.value1}" just does not work. EL thinks there is an expression: my - super == 0

There is a second approach suggested:

If the key is not a legal name, you could use labels['key'] to access, such as labels['foo-yet']

But it does not work either, because expression "${labels['my-super.app.value1']}" is mapped to call "Labels.getSegmentedLabels()", so, the correct call would be like this:

"${labels['my-super']['app']['value1']}"

This form is too complicated. Yes we know we can use

"${c:l('my-super.app.value1')}"

but we think

  1. expression ${labels.my-super.app.value1} is more clear and readable
  2. At least, documentation ZKDeveloper'sReference/Internationalization/Labels shall describe this issue in a more clear way
delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-02-03 10:50:34 +0800

cor3000 gravatar image cor3000
5099 2 7
ZK Team

updated 2020-02-03 10:54:54 +0800

Like anywhere else in zul files, ZK EL expressions follow the JSP Expression Language syntax rules, even if inconvenient at times, that's what it is. There's nothing specific to labels in this regard so it should not be documented redundantly.

If I'm not wrong, it should be possible to do just this as well:

${labels['my-super'].app.value1}
link publish delete flag offensive edit
Your answer
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
1 follower

RSS

Stats

Asked: 2020-01-31 21:00:30 +0800

Seen: 11 times

Last updated: Feb 03

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