<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Setting User&#8217;s Locale Based on Domain Name In Rails</title>
	<atom:link href="http://www.mendable.com/setting-users-locale-based-on-domain-name-in-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mendable.com/setting-users-locale-based-on-domain-name-in-rails/</link>
	<description>Mendable.com - Essential Reading for Ruby on Rails Developers</description>
	<lastBuildDate>Wed, 28 Jul 2010 07:26:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: KonstantinMiller</title>
		<link>http://www.mendable.com/setting-users-locale-based-on-domain-name-in-rails/comment-page-1/#comment-19</link>
		<dc:creator>KonstantinMiller</dc:creator>
		<pubDate>Mon, 06 Jul 2009 19:20:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.mendable.com/?p=82#comment-19</guid>
		<description>I think I will try to recommend this post to my friends and family, cuz it&#039;s really helpful.</description>
		<content:encoded><![CDATA[<p>I think I will try to recommend this post to my friends and family, cuz it&#8217;s really helpful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: codesnik</title>
		<link>http://www.mendable.com/setting-users-locale-based-on-domain-name-in-rails/comment-page-1/#comment-7</link>
		<dc:creator>codesnik</dc:creator>
		<pubDate>Fri, 26 Jun 2009 03:20:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.mendable.com/?p=82#comment-7</guid>
		<description>damn, what a verbose and yet hairy code!

DEFAULT_LANGUAGE_BY_DOMAIN = {
   &quot;com&quot; =&gt; &quot;en&quot;,
   &quot;uk&quot; =&gt; &quot;en&quot;,
   &quot;ru&quot; =&gt; &quot;ru&quot;,
   ...
}

# Setup the locale based on the domain name used to access the website
  before_filter :set_locale
  def set_locale
    this_domain_ext = request.host.split(&#039;.&#039;).last
    I18n.locale = params[:locale] &#124;&#124;
      DEFAULT_LANGUAGE_BY_DOMAIN[this_domain_ext] &#124;&#124;
      &#039;en&#039;
  end</description>
		<content:encoded><![CDATA[<p>damn, what a verbose and yet hairy code!</p>
<p>DEFAULT_LANGUAGE_BY_DOMAIN = {<br />
   &#8220;com&#8221; =&gt; &#8220;en&#8221;,<br />
   &#8220;uk&#8221; =&gt; &#8220;en&#8221;,<br />
   &#8220;ru&#8221; =&gt; &#8220;ru&#8221;,<br />
   &#8230;<br />
}</p>
<p># Setup the locale based on the domain name used to access the website<br />
  before_filter :set_locale<br />
  def set_locale<br />
    this_domain_ext = request.host.split(&#8216;.&#8217;).last<br />
    I18n.locale = params[:locale] ||<br />
      DEFAULT_LANGUAGE_BY_DOMAIN[this_domain_ext] ||<br />
      &#8216;en&#8217;<br />
  end</p>
]]></content:encoded>
	</item>
</channel>
</rss>
