A little problem that i faced with grails , was setting the locale dynamically, i followed this nice article , and here is how i could manage it :
- I made a new file called messages_ar.properties that contains the arabic localization under the i18n folder.
- I made a simple beforeinterceptor:
Of course you can use grails/Filters to save yourself repeating the same code in every controller.
However what i want to mention is the locale object, which in case of Arabic localization, was seeking the country argument ( "JO" in our case) :
While for other localizations like German one it doesn't seek this second argument, so this snippet of code will work for them :)
Also you can change this country argument value to match this rule :
The country argument is a valid ISO Country Code. These codes are the upper-case, two-letter codes as defined by ISO-3166. You can find a full list of these codes at a number of sites, such as:
I hope that was helpful :) , enjoy!