I'd like to create another resource bundle to organize my Grails app. Grails provides a 'messages' resource bundle and I need to create a 'myApp' resource bundle.
How can I create a new resource bundle and read its properties with the 'g:message' GSP tag?
You have to create a bean in grails-app/conf/spring/resources.groovy which will override the default MessageSource.
// Place your Spring DSL code here
beans = {
messageSource(org.springframework.context.support.ReloadableResourceBundleMessageSource) {
basename = "classpath:grails-app/i18n/myApp"
}
}
Note: If you need to customize Grails, the only advise I can give you is to get familiar with the Spring framework (and specifically Spring-MVC) with the following links:
Grails (as of version 1.0.3) will add all property files found in the grails-app/i18n
directory to the resource bundle automatically. No need to add them manually :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With