Grails and Arabic localization

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 :

  1. I made a new file called messages_ar.properties that contains the arabic localization under the i18n folder.
  2. 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:
http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html

I hope that was helpful πŸ™‚ , enjoy!

5 Replies to “Grails and Arabic localization”

  1. Wow, most useful. Can’t rebmemer how many times I’ve written something like this to handle checkbox/multiple select logic. Thank you very much and keep up the good work. πŸ™‚

  2. Express hit above phone number, service is very poor, I did not know the phone was supposed to hang another fancy, occasionally saw this very pretty, after receipt of the goods, a very pleasant surprise, though quite small bag and fit a long wallet, but it is quite user-friendly design, the front and rear mezzanine can put money in the middle of what’s put card package ah, yes, the color is very pretty, very suitable for spring back. I do not know why, was a little block, and friends to buy 79, and this exactly, but I get it back taste, cool taste of what to put on the balcony. The results there were all wrinkled up. Simply can not see.
    oakley optical winnipeg portage http://nhadatbinhduong.org.vn/BraveRouse.aspx?bzBrMGYwOTE1NTE2Zjg5M2Y.html

Leave a Reply

Your email address will not be published. Required fields are marked *