i am trying to get i18n localisation working on an Grails/Groovy enum,
public enum Notification {
GENERIC(0),
CONFIRM_RESERVATION(100),
CONFIRM_ORDE
Sorry for the delay but I think this could help you. I was having the exact same problem with enums and i18n. This is the solution I found:
Following your enum defined before, in your message.properties files put an entry for each value of the enum for example:
enum.value.GENERIC
enum.value.CONFIRM_RESERVATION
enum.value.CONFIRM_ORDER
enum.value.CONFIRM_PAYMENT
Then when you want to show the values of the enum in a select element then do as follows:
According to the Grails documentation regarding the select tag, the value you put in the attribute valueMessagePrefix is used followed by a dot(.) and then the value of the element of the enum. So that way it would go to the message.properties file and search for the lines you put before.
Now, the other thing you would need to do is for example in a list of data, show the value of the enum for each record. In that case you need to do as follows:
${message(code:'enum.value.'+fieldValue(bean: someDomainClass, field: "notification"))}
This is if you have a domain class with one attribute of type Notification.
Hope this helped. Bye!