I’m new to Groovy/Grails, and am currently developing a prototype as a proof of concept. I’m trying to use the i18n functionality built in to Grails to switch the language. I’m using Message Bundles in the property files to do this.
I created messages_cy.properties (that’s Welsh) under the i18n directory, and when I append ?lang=cy to the end of the URL It all seems to be working fine.
However, when I navigate to the home page (currently the default Welcome to Grails page), it switches the locale back to ‘en’, whenever I navigate to another page, it switches back to what it was before.
I’m used dynamic scaffolding at the moment which is creating the controller and views for me, which we will probably change eventually. I’m not sure if this is causing the issue. The home page (index.gsp) is the only page that is not dynamically scaffolded.
Can anyone shed any light on this? Thanks.
I solved this by creating a
HomeControllerand used the UrlMapping.groovy to map theHomeController to the root URL.HomeController.groovy
UrlMappings.groovy