Hello,
Actually, there is a bug in Grails scripts. When packaging, Grails will copy only .properties files located under the folder /grails-app/i18n. Your XML files will be ignored.
To fix it, you can manually edit the file *{grails-sources}/scripts/GrailsPackage.groovy.
Look for:
if(config.grails.enable.native2ascii) {
profile("converting native message bundles to ascii") {
ant.native2ascii(src:"${basedir}/grails-app/i18n",
dest:i18nDir,
includes:"*.properties",
encoding:"UTF-8")
}
}
else {
ant.copy(todir:i18nDir) {
fileset(dir:"${basedir}/grails-app/i18n", includes:"*.properties")
}
}
And replace by:
if(config.grails.enable.native2ascii) {
profile("converting native message bundles to ascii") {
ant.native2ascii(src:"${basedir}/grails-app/i18n",
dest:i18nDir,
includes:"*.properties, *.xml",
encoding:"UTF-8")
}
}
else {
ant.copy(todir:i18nDir) {
fileset(dir:"${basedir}/grails-app/i18n", includes:"*.properties, *.xml")
}
}
It will copy your messages*.xml in the resources path of your Grails app next time you run it.
You can use messages.xml as a starting point - it has to respect the Java DTD.
Using in your views will work as it worked with messages.properties files.