Friday, March 14, 2014
Spring Java Script Decorator Message Internationalization
How do I achieve internationalization when using Spring Java Script Decorator?
See the following example for the answer. Note that text.invalid.coordinates should be defined in a message.properties file where the JSP can access.
<div class="sp-field">
<form:input cssClass="sp-textfield" path="missingNetworkNodeList.elements[${rowCounter.index}].coordinates.latitudeLongitude" />
<spring:message code="text.invalid.coordinates" var="invalidCor"/>
<script type="text/javascript">
Spring.addDecoration(new Spring.ElementDecoration({
elementId : "missingNetworkNodeList.elements${rowCounter.index}.coordinates.latitudeLongitude",
widgetType : "dijit.form.ValidationTextBox",
widgetAttrs : {
invalidMessage: "${invalidCor}",
regExp: "^-?([0-8]?[0-9])\.[0-9]{1,6},-?((1?[0-7]?|[0-9]?)[0-9])\.[0-9]{1,6}"
}
}));
</script>
</div>
Subscribe to:
Posts (Atom)