Search code examples
grailsgroovypropertiesinternationalizationmultilingual

How to access to a property defined in messages.properties file?


I have a Groovy Grails application and I want to access programmatically to a property defined in messages.properties.

As a test, I've tried the following statement:

println "capacity.created: ${messages.properties['capacity.created']}"

But it doesn't work (throws an exception).

Any help is welcomed.

Luis


Solution

  • I found a way to access to message properties directly wothout re-reading all the messages properties files (message_de.properties, message_fr.properties, etc.) It is is very easy.

    message(code:"capacity.created")
    

    and it works!

    Luis