<?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>La rolls des blogs &#187; I18n</title>
	<atom:link href="http://my.rails-royce.org/tag/i18n/feed/" rel="self" type="application/rss+xml" />
	<link>http://my.rails-royce.org</link>
	<description>Another Ruby and Rails blog</description>
	<lastBuildDate>Fri, 13 Jan 2012 23:47:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>gettext 2.0.4 and rails 2.3.4</title>
		<link>http://my.rails-royce.org/2009/10/08/gettext-2-0-4-and-rails-2-3-4/</link>
		<comments>http://my.rails-royce.org/2009/10/08/gettext-2-0-4-and-rails-2-3-4/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 08:09:04 +0000</pubDate>
		<dc:creator>Hallelujah</dc:creator>
				<category><![CDATA[metaprogramming]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[2.0.4]]></category>
		<category><![CDATA[2.3.4]]></category>
		<category><![CDATA[activerecord]]></category>
		<category><![CDATA[active_record]]></category>
		<category><![CDATA[gettext]]></category>
		<category><![CDATA[I18n]]></category>
		<category><![CDATA[internationalisation]]></category>
		<category><![CDATA[internationalization]]></category>
		<category><![CDATA[L10n]]></category>
		<category><![CDATA[localization]]></category>

		<guid isPermaLink="false">http://my.rails-royce.org/?p=122</guid>
		<description><![CDATA[Rails 2.3.4 broke gettext_activerecord 2.0.4 Well I did not test other gems of the mutoh gettext set of libraries but here is the gulty code that breaks rails. Since Activerecord::Errors changed its implementation a bit, an error like this is raised : NoMethodError: undefined method `gsub' for #&#60;ActiveRecord::Error:0x00000002919738&#62; from /home/hallelujah/Jail/lib/ruby/gems/1.9.1/gems/gettext_activerecord-2.0.4/lib/gettext_activerecord/validations.rb:165:in `localize_error_message' from /home/hallelujah/Jail/lib/ruby/gems/1.9.1/gems/gettext_activerecord-2.0.4/lib/gettext_activerecord/validations.rb:112:in `block &#40;2 &#8230; </p><p><a class="more-link block-button" href="http://my.rails-royce.org/2009/10/08/gettext-2-0-4-and-rails-2-3-4/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>Rails 2.3.4 broke gettext_activerecord 2.0.4</p>
<p>Well I did not test other gems of the <a href="http://github.com/mutoh">mutoh gettext set of libraries</a> but here is the gulty code that breaks rails.<br />
Since Activerecord::Errors changed its implementation a bit, an error like this is raised :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">NoMethodError: undefined method <span style="color: #000000; font-weight: bold;">`</span>gsub<span style="color: #ff0000;">' for #&lt;ActiveRecord::Error:0x00000002919738&gt;
        from /home/hallelujah/Jail/lib/ruby/gems/1.9.1/gems/gettext_activerecord-2.0.4/lib/gettext_activerecord/validations.rb:165:in `localize_error_message'</span>
        from <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>hallelujah<span style="color: #000000; font-weight: bold;">/</span>Jail<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>ruby<span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span>1.9.1<span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span>gettext_activerecord-2.0.4<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>gettext_activerecord<span style="color: #000000; font-weight: bold;">/</span>validations.rb:<span style="color: #000000;">112</span>:<span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span>block <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2</span> levels<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">in</span> each_with_gettext_activerecord<span style="color: #ff0000;">'
        from /home/hallelujah/Jail/lib/ruby/gems/1.9.1/gems/gettext_activerecord-2.0.4/lib/gettext_activerecord/validations.rb:112:in `each'</span>
        from <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>hallelujah<span style="color: #000000; font-weight: bold;">/</span>Jail<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>ruby<span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span>1.9.1<span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span>gettext_activerecord-2.0.4<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>gettext_activerecord<span style="color: #000000; font-weight: bold;">/</span>validations.rb:<span style="color: #000000;">112</span>:<span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span>block <span style="color: #000000; font-weight: bold;">in</span> each_with_gettext_activerecord<span style="color: #ff0000;">'
        from /home/hallelujah/Jail/lib/ruby/gems/1.9.1/gems/gettext_activerecord-2.0.4/lib/gettext_activerecord/validations.rb:112:in `each_key'</span>
        from <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>hallelujah<span style="color: #000000; font-weight: bold;">/</span>Jail<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>ruby<span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span>1.9.1<span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span>gettext_activerecord-2.0.4<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>gettext_activerecord<span style="color: #000000; font-weight: bold;">/</span>validations.rb:<span style="color: #000000;">112</span>:<span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span>each_with_gettext_activerecord<span style="color: #ff0000;">'</span></pre></div></div>

<p>You can add this piece of code after your gems and rails are loaded (e.g at the bottom of config/environment.rb )</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">module</span> ActiveRecord
  <span style="color:#9966CC; font-weight:bold;">class</span> Errors
    <span style="color:#9966CC; font-weight:bold;">def</span> localize_error_message_with_patch<span style="color:#006600; font-weight:bold;">&#40;</span>attr,obj, append_field<span style="color:#006600; font-weight:bold;">&#41;</span>
      obj = obj.<span style="color:#9900CC;">respond_to</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:message</span><span style="color:#006600; font-weight:bold;">&#41;</span> ? obj.<span style="color:#9900CC;">message</span> : obj
      localize_error_message_without_patch<span style="color:#006600; font-weight:bold;">&#40;</span>attr,obj,append_field<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
    alias_method_chain <span style="color:#ff3333; font-weight:bold;">:localize_error_message</span>, <span style="color:#ff3333; font-weight:bold;">:patch</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>I think I will patch gettext_activerecord and the muto gettext set of library to fit in rails 2.3.4<br />
Maybe I may keep an eye on Rails 3.0 development.</p>
]]></content:encoded>
			<wfw:commentRss>http://my.rails-royce.org/2009/10/08/gettext-2-0-4-and-rails-2-3-4/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

