0

Date format internationalization

asked 2009-08-18 11:35:37 +0800

network09 gravatar image network09
132 3

updated 2009-08-18 11:36:11 +0800

Hi, I am having troubles with internationalization of date format. Here is my issue: instead of using

 <listcell label="@{utente.dataNascita,converter='org.zkoss.zkplus.databind.DateFormatConverter'}" self="@{format(dd/MM/yyyy)}"/>

I would like to write something like this:

<listcell label="@{utente.dataNascita,converter='org.zkoss.zkplus.databind.DateFormatConverter'}" self="@{format(${c:l('date.format')})}"/>

Obviously I would create in a properties file the following association:

date.format=dd/MM/yyyy

Does anyone have a suggestion? Thank you very much

delete flag offensive retag edit

5 Replies

Sort by » oldest newest

answered 2009-08-18 13:28:51 +0800

madruga0315 gravatar image madruga0315 flag of Brazil
937 2 12

I believe that the problem here is mixing data bind (@{...}) with EL expression (${c:l(...)}).

You could implement your own DateFormatConverter or just extend zkoss DateFormatConverter and in the constructor you call

setFormat(Labels.getLabel("date.format"));

then in your zul you dont need the self="@{format...." part

Regards,
Madruga

link publish delete flag offensive edit

answered 2009-08-18 15:30:43 +0800

network09 gravatar image network09
132 3

Thank you, I'll try this solution. Regards

link publish delete flag offensive edit

answered 2010-05-25 09:54:35 +0800

antraxer gravatar image antraxer
6

Anyway, the first solution presented save my day :)


De qualquer forma a primeira solução apresentada salvou meu dia :)

link publish delete flag offensive edit

answered 2010-05-25 10:57:19 +0800

robertpic71 gravatar image robertpic71
1275 1

updated 2010-05-25 10:57:46 +0800

Do complete this thread:

self="@{.." is a helper for a simpler custom-attribute-syntax:

For non-simple works, the following code should work:

<listcell label="@{utente.dataNascita,converter='org.zkoss.zkplus.databind.DateFormatConverter'}">
<custom-attribute format="${c:l('date.format')}"/>
</listcell>

Another way is to use an own typeconverter:
Check this link for examples.

Note: The Typeconvert DateUser retrieves the client-countrysettings (browser!) and enables the user-sensity-date.
However, this is a little bit overkill for the most applications. Just retrieve the server-settings inside the contructor should
work for the most (non-international) applications.

/Robert

link publish delete flag offensive edit

answered 2010-05-27 04:11:39 +0800

xmedeko gravatar image xmedeko
1021 1 16
http://xmedeko.blogspot.c...

@robertpic71: Do you mean "<custom-attributes format=..."? It does not work (at least not in ZK 3.6.4.)

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: 2009-08-18 11:35:37 +0800

Seen: 1,602 times

Last updated: May 27 '10

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