Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails: Change contents of message.properties (i18n) in production

Is is possible to modify text in message.properties when in production without a redeploy/restart.

like image 340
dre Avatar asked Jan 30 '26 03:01

dre


1 Answers

It's quite possible, but you need to replace the default messageSource bean with a ReloadableResourceBundleMessageSource. You can do this by configuring a new messageSource bean definition in your grails-app/conf/spring/resources.groovy as follows:

beans = {
      messageSource(org.springframework.context.support.ReloadableResourceBundleMessageSource) {
        basenames = ["classpath:grails-app/i18n/myApp", "file:grails-app/i18n/messages", "WEB-INF/grails-app/i18n/messages"]
    }
}

The above will work in both development and production. You may also want to research other options available to you using the ReloadableResourceBundleMessageSource.

like image 105
Joshua Moore Avatar answered Feb 01 '26 21:02

Joshua Moore