I am in the process of localizing a rather large GWT UIbinder code base and ran across a couple of instances where the process of setting attributes does not work.
I need to specify the date format and number format in a LocalizableResource_xx.properties file for DateLabel and NumberLabel widgets.
I tried converting this fragment
<g:DateLabel styleName="{style.formPromptData}"
ui:field="createDate" customFormat="MMM d, yyyy" />
using the ui:attribute method with no success
Invoking generator com.google.gwt.uibinder.rebind.UiBinderGenerator
[ERROR] No method found to apply message attribute customFormat Element (:63)
Is there a way to localize these elements?
customFormat="XXX"translates toDateTimeFormat.getFormat("XXX")and is no different wrt localization: that is, it’s not localizable.If you want a localizable custom format, use a
CustomDateTimeFormat(that currently relies on ICU4J’sDateTimePatternGenerator) or aConstantsorMessagesinterface. Instantiate it with<ui:with>and use withcustomFormat="{intf.customPattern}"(format="{intf.customPattern}"actually if you use aCustomDateTimeFormat).