-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4583875
By: khainodd
Hello all,
I don't know if I should put the desired features directly in the tracker or if I should wait until someone in the team asks me to. So, I'd rather wait for someone to tell me if I can post it in the tracker.
I think it would be a good idea if Labels.getLabel("hello") would return "[[hello]]"
or something like if the label does not exist in the properties file. So it would be easier to debug and complete the labels forgotten when writing code.
Thank you all, and keep the good work! :)
We are in 2015 and this is not possible!? i try to override LabelLoader:
<library-property> <name>org.zkoss.util.resource.LabelLoader.class</name> <value>my.package.LabelLoader</value> </library-property>
but for some reasons did not work the way i expected: not called from: <label value="${labels.app.title}" <="" p="">
but from Labels.getLabel from java class & from zul 'system' files...
any idea i can do it?
Actually this is already possible from the moment taglibs are there.
It's already provided in the Label class long time ago but never got into the core taglib.
So you could create your own taglib (under WEB-INF/tld/xxx.tld):
<taglib>
<!-- Retrieve an I18N string with a default value -->
<function>
<name>labelDef</name>
<function-class>org.zkoss.util.resource.Labels</function-class>
<function-signature>
java.lang.String getLabel(java.lang.String, java.lang.String)
</function-signature>
<description>Retrieve a label with a default.</description>
</function>
</taglib>
and usage :
<?taglib uri="/WEB-INF/tld/xxx.tld" prefix="i18n"?>
<label value="${i18n:labelDef('mykey','default value')}/>
Asked: 2007-10-23 11:01:53 +0800
Seen: 483 times
Last updated: Nov 27 '15