-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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
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"));
Regards,
Madruga
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
@robertpic71: Do you mean "<custom-attributes format=..."? It does not work (at least not in ZK 3.6.4.)
Asked: 2009-08-18 11:35:37 +0800
Seen: 1,606 times
Last updated: May 27 '10