Localizing validation (error) messages in Grails
Posted
by
John
on Stack Overflow
See other posts from Stack Overflow
or by John
Published on 2011-01-12T15:50:18Z
Indexed on
2011/01/12
15:53 UTC
Read the original article
Hit count: 158
Hi, I try to localize error messages from the Domain classes. This is possible with the default error messages, e.g.:
default.blank.message=Property [{0}] cannot be blank
and localized attribute names, e.g.:
customer.address.label=Customer address
Where "Customer" is my domain class and address is its attribute.
My problem is that I can't localize some attributes because I need specific error messages. E.g:
has.to.be.a.number=Property [{0}] has to be a number
contingent.size.label=Contingent size.
But the message I get is "Property [size] has to be a number" instead of "Property [Contingent size] has to be a number".
The messages I cant localize are following: - Property [{0}] has to be a number - Property [{0}] has to be a valid date // I can't use g:datePicker in this context
© Stack Overflow or respective owner