<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Khelll&#039;s Blog &#187; Grails</title>
	<atom:link href="http://khelll.com/blog/tag/grails/feed/" rel="self" type="application/rss+xml" />
	<link>http://khelll.com/blog</link>
	<description>Cool Web Development...</description>
	<lastBuildDate>Thu, 13 Oct 2011 03:48:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Grails and Arabic localization</title>
		<link>http://khelll.com/blog/grails/grails-and-arabic-localization/</link>
		<comments>http://khelll.com/blog/grails/grails-and-arabic-localization/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 16:08:29 +0000</pubDate>
		<dc:creator>khelll</dc:creator>
				<category><![CDATA[Grails]]></category>
		<category><![CDATA[arabic]]></category>
		<category><![CDATA[localization]]></category>

		<guid isPermaLink="false">http://www.khelll.com/blog/?p=35</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://khelll.com/blog/grails/grails-and-arabic-localization/' addthis:title='Grails and Arabic localization '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>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 &#8230; <a href="http://khelll.com/blog/grails/grails-and-arabic-localization/">Continue reading <span class="meta-nav">&#8594;</span></a><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://khelll.com/blog/grails/grails-and-arabic-localization/' addthis:title='Grails and Arabic localization' ><a class="addthis_button_twitter"></a><a class="addthis_button_facebook"></a><a class="addthis_button_email"></a><a class="addthis_button_print"></a><a class="addthis_button_compact"></a></div>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://khelll.com/blog/grails/grails-and-arabic-localization/' addthis:title='Grails and Arabic localization '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>A little problem that i faced with grails , was setting the locale dynamically, i followed this <a href="http://www.grassr.com/wordpress/?p=12">nice article</a> , and here is how i could manage it :</p>
<ol>
<li>I made a new file called messages_ar.properties that contains the arabic localization under the i18n folder.</li>
<li>I made a simple beforeinterceptor:

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">def</span> beforeInterceptor <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">def</span> key <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">&quot;org.springframework.web.servlet.DispatcherServlet.LOCALE_RESOLVER&quot;</span>
        <span style="color: #000000; font-weight: bold;">def</span> localeResolver <span style="color: #66cc66;">=</span> request.<span style="color: #006600;">getAttribute</span><span style="color: #66cc66;">&#40;</span>key<span style="color: #66cc66;">&#41;</span>
        localeResolver.<span style="color: #006600;">setLocale</span><span style="color: #66cc66;">&#40;</span>request, response, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #aaaadd; font-weight: bold;">Locale</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;ar&quot;</span>,<span style="color: #ff0000;">&quot;JO&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#125;</span></pre></div></div>

</li>
</ol>
<p>Of course you can use <a href="http://grails.org/Filters">grails/Filters</a> to save yourself repeating the same code in every controller.</p>
<p>However what i want to mention is the locale object, which in case of Arabic localization, was seeking  the country argument ( &#8220;JO&#8221; in our case) :</p>

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #aaaadd; font-weight: bold;">Locale</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;ar&quot;</span>,<span style="color: #ff0000;">&quot;JO&quot;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>While for other localizations like German one it doesn&#8217;t seek this second argument, so this snippet of code will work for them <img src='http://khelll.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #aaaadd; font-weight: bold;">Locale</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;de&quot;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>Also you can change this country argument value to match this rule :</p>
<blockquote><p>
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:</p>
<p>http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html</p></blockquote>
<p>I hope that was helpful <img src='http://khelll.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  , enjoy!</p>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://khelll.com/blog/grails/grails-and-arabic-localization/' addthis:title='Grails and Arabic localization' ><a class="addthis_button_twitter"></a><a class="addthis_button_facebook"></a><a class="addthis_button_email"></a><a class="addthis_button_print"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://khelll.com/blog/grails/grails-and-arabic-localization/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

