<?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: Rails Localization Plugin Release Version 0.9</title>
	<atom:link href="http://justaddwater.dk/2008/01/13/rails-localization-plugin-release-version-09/feed/" rel="self" type="application/rss+xml" />
	<link>http://justaddwater.dk/2008/01/13/rails-localization-plugin-release-version-09/</link>
	<description>Instant Usability &#38; Web Standards</description>
	<lastBuildDate>Sat, 28 Jan 2012 13:44:35 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Mosfet</title>
		<link>http://justaddwater.dk/2008/01/13/rails-localization-plugin-release-version-09/comment-page-1/#comment-487489</link>
		<dc:creator>Mosfet</dc:creator>
		<pubDate>Mon, 13 Jul 2009 18:06:01 +0000</pubDate>
		<guid isPermaLink="false">http://justaddwater.dk/2008/01/13/rails-localization-plugin-release-version-09/#comment-487489</guid>
		<description>Webrick server can now launch, but an error occurs in an edit rendering:

ArgumentError in Opes#edit

Showing app/views/opes/edit.html.erb where line #13 raised:

wrong number of arguments (4 for 3)
Extracted source (around line #13):

10:   Date de relevé					
11: 	&lt;!-- Infos modifiables --&gt;
12: 	
13:     Date de l&#039;opération	
14:     Montant							
15:     Libellé							
16:     
RAILS_ROOT: /Users/admin/Documents/Rails/MyMoney

Application Trace &#124; Framework Trace &#124; Full Trace
/Users/admin/Documents/Rails/MyMoney/vendor/rails/actionpack/lib/action_view/helpers/date_helper.rb:964:in `date_select&#039;
/Users/admin/Documents/Rails/MyMoney/vendor/rails/actionpack/lib/action_view/helpers/date_helper.rb:964:in `date_select&#039;
/Users/admin/Documents/Rails/MyMoney/app/views/opes/edit.html.erb:13:in `_run_erb_app47views47opes47edit46html46erb&#039;
/Users/admin/Documents/Rails/MyMoney/app/views/opes/edit.html.erb:12:in `_run_erb_app47views47opes47edit46html46erb&#039;

Any idea?</description>
		<content:encoded><![CDATA[<p>Webrick server can now launch, but an error occurs in an edit rendering:</p>
<p>ArgumentError in Opes#edit</p>
<p>Showing app/views/opes/edit.html.erb where line #13 raised:</p>
<p>wrong number of arguments (4 for 3)<br />
Extracted source (around line #13):</p>
<p>10:   Date de relevé<br />
11: 	<!-- Infos modifiables --><br />
12:<br />
13:     Date de l&#8217;opération<br />
14:     Montant<br />
15:     Libellé<br />
16:<br />
RAILS_ROOT: /Users/admin/Documents/Rails/MyMoney</p>
<p>Application Trace | Framework Trace | Full Trace<br />
/Users/admin/Documents/Rails/MyMoney/vendor/rails/actionpack/lib/action_view/helpers/date_helper.rb:964:in `date_select&#8217;<br />
/Users/admin/Documents/Rails/MyMoney/vendor/rails/actionpack/lib/action_view/helpers/date_helper.rb:964:in `date_select&#8217;<br />
/Users/admin/Documents/Rails/MyMoney/app/views/opes/edit.html.erb:13:in `_run_erb_app47views47opes47edit46html46erb&#8217;<br />
/Users/admin/Documents/Rails/MyMoney/app/views/opes/edit.html.erb:12:in `_run_erb_app47views47opes47edit46html46erb&#8217;</p>
<p>Any idea?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mosfet</title>
		<link>http://justaddwater.dk/2008/01/13/rails-localization-plugin-release-version-09/comment-page-1/#comment-487484</link>
		<dc:creator>Mosfet</dc:creator>
		<pubDate>Mon, 13 Jul 2009 17:06:10 +0000</pubDate>
		<guid isPermaLink="false">http://justaddwater.dk/2008/01/13/rails-localization-plugin-release-version-09/#comment-487484</guid>
		<description>Hi Jesper,
I&#039;m currently using Rails 2.3.2 and have experienced some problems when using your plugin:
/Users/admin/Documents/Rails/MyMoney/vendor/plugins/l10n-simplified-0.9/lib/localization_simplified.rb:24: uninitialized class variable @@default_error_messages in ActiveRecord::Errors (NameError)

To make it work well, I had to replace following lines in localization_simplified.rb:
module ActiveRecord
  class Errors
    #Error messages modified in lang file    @@default_error_messages.update(LocalizationSimplified::ActiveRecord::ErrorMessages)
  end
end

by those:
module ActiveRecord
  class Errors
    #Error messages modified in lang file     I18n.translate(LocalizationSimplified::ActiveRecord::ErrorMessages)
  end
end

Thank you very much for your plugin! And I&#039;ll be reading your other contributions on your web site!</description>
		<content:encoded><![CDATA[<p>Hi Jesper,<br />
I&#8217;m currently using Rails 2.3.2 and have experienced some problems when using your plugin:<br />
/Users/admin/Documents/Rails/MyMoney/vendor/plugins/l10n-simplified-0.9/lib/localization_simplified.rb:24: uninitialized class variable @@default_error_messages in ActiveRecord::Errors (NameError)</p>
<p>To make it work well, I had to replace following lines in localization_simplified.rb:<br />
module ActiveRecord<br />
  class Errors<br />
    #Error messages modified in lang file    @@default_error_messages.update(LocalizationSimplified::ActiveRecord::ErrorMessages)<br />
  end<br />
end</p>
<p>by those:<br />
module ActiveRecord<br />
  class Errors<br />
    #Error messages modified in lang file     I18n.translate(LocalizationSimplified::ActiveRecord::ErrorMessages)<br />
  end<br />
end</p>
<p>Thank you very much for your plugin! And I&#8217;ll be reading your other contributions on your web site!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jesper Rønn-Jensen</title>
		<link>http://justaddwater.dk/2008/01/13/rails-localization-plugin-release-version-09/comment-page-1/#comment-421168</link>
		<dc:creator>Jesper Rønn-Jensen</dc:creator>
		<pubDate>Fri, 30 May 2008 10:25:13 +0000</pubDate>
		<guid isPermaLink="false">http://justaddwater.dk/2008/01/13/rails-localization-plugin-release-version-09/#comment-421168</guid>
		<description>@hans

i have now added you on RubyForge as administrator (along with casperfabricius).

You don\t have to add a patch... just apply it in the relevant file(s). Also, make sure to add the commit comment + date + author in the changelog file as well when you commit 


Thanks a lot for putting effort into it :)</description>
		<content:encoded><![CDATA[<p>@hans</p>
<p>i have now added you on RubyForge as administrator (along with casperfabricius).</p>
<p>You don\t have to add a patch&#8230; just apply it in the relevant file(s). Also, make sure to add the commit comment + date + author in the changelog file as well when you commit </p>
<p>Thanks a lot for putting effort into it :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans</title>
		<link>http://justaddwater.dk/2008/01/13/rails-localization-plugin-release-version-09/comment-page-1/#comment-421137</link>
		<dc:creator>Hans</dc:creator>
		<pubDate>Fri, 30 May 2008 07:52:12 +0000</pubDate>
		<guid isPermaLink="false">http://justaddwater.dk/2008/01/13/rails-localization-plugin-release-version-09/#comment-421137</guid>
		<description>Hi !
Do I just add my patch as a file or are there more formal ways to add the patch?
My Rubyforge user account  is marmolin.

I will now try to make it possible to change language dynamically, I do not really know how as I hope to find a solution that can work as an option, without changing your original plugin too much. I am just looking at rubys possibilities for dynamic compilation. 
Do you have any suggestions ?</description>
		<content:encoded><![CDATA[<p>Hi !<br />
Do I just add my patch as a file or are there more formal ways to add the patch?<br />
My Rubyforge user account  is marmolin.</p>
<p>I will now try to make it possible to change language dynamically, I do not really know how as I hope to find a solution that can work as an option, without changing your original plugin too much. I am just looking at rubys possibilities for dynamic compilation.<br />
Do you have any suggestions ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jesper Rønn-Jensen</title>
		<link>http://justaddwater.dk/2008/01/13/rails-localization-plugin-release-version-09/comment-page-1/#comment-421056</link>
		<dc:creator>Jesper Rønn-Jensen</dc:creator>
		<pubDate>Thu, 29 May 2008 23:16:34 +0000</pubDate>
		<guid isPermaLink="false">http://justaddwater.dk/2008/01/13/rails-localization-plugin-release-version-09/#comment-421056</guid>
		<description>Hans. thanks a lot for the patch -- i&#039;m very sorry i did not manage to commit your patch before my vacation.

I will give you commit access to the repository and want you to commit this patch in (as i&#039;m on my way on vacation). Unfortunately i do not know your Rubyforge user account name. Please send me.

This way you will also have access to commit in future patches. (this is actually the idea of Rubinius&#039; Evan Phoenix and i am very inspired by opening up the code to everybody interesting to contributing :)</description>
		<content:encoded><![CDATA[<p>Hans. thanks a lot for the patch &#8212; i&#8217;m very sorry i did not manage to commit your patch before my vacation.</p>
<p>I will give you commit access to the repository and want you to commit this patch in (as i&#8217;m on my way on vacation). Unfortunately i do not know your Rubyforge user account name. Please send me.</p>
<p>This way you will also have access to commit in future patches. (this is actually the idea of Rubinius&#8217; Evan Phoenix and i am very inspired by opening up the code to everybody interesting to contributing :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans</title>
		<link>http://justaddwater.dk/2008/01/13/rails-localization-plugin-release-version-09/comment-page-1/#comment-420850</link>
		<dc:creator>Hans</dc:creator>
		<pubDate>Wed, 28 May 2008 16:59:17 +0000</pubDate>
		<guid isPermaLink="false">http://justaddwater.dk/2008/01/13/rails-localization-plugin-release-version-09/#comment-420850</guid>
		<description>I don&#039;t dare to use localized attribute names in the models as rails and ruby are based on English conventions. I therefore prefer another solution that performs the translation as the last step before displaying the word. However, this solution is more like a fix and there should be better solutions. Anyhow, here is my path, that works for me. More pathes may follow regarding the other parts of your plugin as date etc.

      def error_messages_for(*params)
         options = params.last.is_a?(Hash) ? params.pop.symbolize_keys : {}
         objects = params.collect {&#124;object_name&#124; instance_variable_get(&quot;@#{object_name}&quot;) }.compact
         count   = objects.inject(0) {&#124;sum, object&#124; sum + object.errors.count }
         unless count.zero?
           html = {}
           [:id, :class].each do &#124;key&#124;
             if options.include?(key)
               value = options[key]
               html[key] = value unless value.blank?
             else
               html[key] = &#039;errorExplanation&#039;
             end
           end
           messages = ActiveRecord:: Errors.default_error_messages
           header_message = format( messages[:error_header], 
             pluralize(count, messages[:error_translation]), 
             (options[:object_name] &#124;&#124; 
             	params.first).to_s.gsub(&quot;_&quot;, &quot; &quot;))
             error_messages = objects.map {&#124;object&#124; object.errors.full_messages.map {&#124;msg&#124; content_tag(:li, msg) } }

            # Patch do translate variablenames with localisation plugin
             # Own error messages (:message =&gt; Example) had to be translated in the validation specification (:message =&gt; _(Example)) 
             # error_messages_string=error_messages.join(&#039;%&#039;)
             error_messages.each_index do &#124;ix&#124;
               error_messages[ix].each_index do &#124;jx&#124;
                  objects.each do &#124;object&#124; 
                   object.attributes.each_key do &#124;attribute&#124; 
                     variable=attribute.humanize
                     translated_variable=_(variable)  #Translation method in Localization plugin
                     error_messages[ix][jx]=error_messages[ix][jx].gsub(variable,translated_variable)
                     error_messages[ix][jx]= error_messages[ix][jx].gsub(&#039;confirmation&#039;,_(&#039;confirmation&#039;)) #Fix to handle password confirmation, that not is an attribute ? 
                  end
                 end
              end
           end
          # end patch

           content_tag(:div,
             content_tag(options[:header_tag] &#124;&#124; :h2, header_message) &lt;&lt;
               content_tag(:p, messages[:error_subheader]) &lt;&lt;
               content_tag(:ul, error_messages),
             html
           )
         else
           &#039;&#039;
         end
       end
     end</description>
		<content:encoded><![CDATA[<p>I don&#8217;t dare to use localized attribute names in the models as rails and ruby are based on English conventions. I therefore prefer another solution that performs the translation as the last step before displaying the word. However, this solution is more like a fix and there should be better solutions. Anyhow, here is my path, that works for me. More pathes may follow regarding the other parts of your plugin as date etc.</p>
<p>      def error_messages_for(*params)<br />
         options = params.last.is_a?(Hash) ? params.pop.symbolize_keys : {}<br />
         objects = params.collect {|object_name| instance_variable_get(&#8220;@#{object_name}&#8221;) }.compact<br />
         count   = objects.inject(0) {|sum, object| sum + object.errors.count }<br />
         unless count.zero?<br />
           html = {}<br />
           [:id, :class].each do |key|<br />
             if options.include?(key)<br />
               value = options[key]<br />
               html[key] = value unless value.blank?<br />
             else<br />
               html[key] = &#8216;errorExplanation&#8217;<br />
             end<br />
           end<br />
           messages = ActiveRecord:: Errors.default_error_messages<br />
           header_message = format( messages[:error_header],<br />
             pluralize(count, messages[:error_translation]),<br />
             (options[:object_name] ||<br />
             	params.first).to_s.gsub(&#8220;_&#8221;, &#8221; &#8220;))<br />
             error_messages = objects.map {|object| object.errors.full_messages.map {|msg| content_tag(:li, msg) } }</p>
<p>            # Patch do translate variablenames with localisation plugin<br />
             # Own error messages (:message =&gt; Example) had to be translated in the validation specification (:message =&gt; _(Example))<br />
             # error_messages_string=error_messages.join(&#8216;%&#8217;)<br />
             error_messages.each_index do |ix|<br />
               error_messages[ix].each_index do |jx|<br />
                  objects.each do |object|<br />
                   object.attributes.each_key do |attribute|<br />
                     variable=attribute.humanize<br />
                     translated_variable=_(variable)  #Translation method in Localization plugin<br />
                     error_messages[ix][jx]=error_messages[ix][jx].gsub(variable,translated_variable)<br />
                     error_messages[ix][jx]= error_messages[ix][jx].gsub(&#8216;confirmation&#8217;,_(&#8216;confirmation&#8217;)) #Fix to handle password confirmation, that not is an attribute ?<br />
                  end<br />
                 end<br />
              end<br />
           end<br />
          # end patch</p>
<p>           content_tag(:div,<br />
             content_tag(options[:header_tag] || :h2, header_message) &lt;&lt;<br />
               content_tag(:p, messages[:error_subheader]) &lt;&lt;<br />
               content_tag(:ul, error_messages),<br />
             html<br />
           )<br />
         else<br />
           &#8221;<br />
         end<br />
       end<br />
     end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jesper Rønn-Jensen</title>
		<link>http://justaddwater.dk/2008/01/13/rails-localization-plugin-release-version-09/comment-page-1/#comment-420755</link>
		<dc:creator>Jesper Rønn-Jensen</dc:creator>
		<pubDate>Tue, 27 May 2008 20:48:23 +0000</pubDate>
		<guid isPermaLink="false">http://justaddwater.dk/2008/01/13/rails-localization-plugin-release-version-09/#comment-420755</guid>
		<description>Hans, feel free to submit a patch for your suggestion -- currently i&#039;m almost off on vacation (later this week). I&#039;ll gladly commit any patches I recieve Thursday at the latest.

Concerning translation of attribute names, that feature is not implemented in LocalizationSimplified.In a previous project, I used Danish model + attribute names and added the proper pluralization rules in inflections. 

That worked fine, so that&#039;s an option if you can live with translated model/attributes.</description>
		<content:encoded><![CDATA[<p>Hans, feel free to submit a patch for your suggestion &#8212; currently i&#8217;m almost off on vacation (later this week). I&#8217;ll gladly commit any patches I recieve Thursday at the latest.</p>
<p>Concerning translation of attribute names, that feature is not implemented in LocalizationSimplified.In a previous project, I used Danish model + attribute names and added the proper pluralization rules in inflections. </p>
<p>That worked fine, so that&#8217;s an option if you can live with translated model/attributes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans</title>
		<link>http://justaddwater.dk/2008/01/13/rails-localization-plugin-release-version-09/comment-page-1/#comment-420748</link>
		<dc:creator>Hans</dc:creator>
		<pubDate>Tue, 27 May 2008 19:22:47 +0000</pubDate>
		<guid isPermaLink="false">http://justaddwater.dk/2008/01/13/rails-localization-plugin-release-version-09/#comment-420748</guid>
		<description>maybe you can solve it as in the localization plugin. They has an attribute in there localisation module named lang and you can set that attribute  Localization.lang=:se in your controller. Maybe it could be possible to set  LocalizationSimplified.l10n_lang in an controller.
How about my problem concerning translating the  attribute names</description>
		<content:encoded><![CDATA[<p>maybe you can solve it as in the localization plugin. They has an attribute in there localisation module named lang and you can set that attribute  Localization.lang=:se in your controller. Maybe it could be possible to set  LocalizationSimplified.l10n_lang in an controller.<br />
How about my problem concerning translating the  attribute names</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jesper Rønn-Jensen</title>
		<link>http://justaddwater.dk/2008/01/13/rails-localization-plugin-release-version-09/comment-page-1/#comment-420744</link>
		<dc:creator>Jesper Rønn-Jensen</dc:creator>
		<pubDate>Tue, 27 May 2008 18:44:44 +0000</pubDate>
		<guid isPermaLink="false">http://justaddwater.dk/2008/01/13/rails-localization-plugin-release-version-09/#comment-420744</guid>
		<description>@lolo and @Hans. I would gladly fix init.rb right away, but before I do, help me out with this:

I really prefer if the plugin could be overwritten later with a recent version. And plugins work best if we can keep them pristine with no project specific changes. Therefore I wanted to be able to place the settings like L10N_LANG in more appropriate places.

Any suggestions on how I could honor that principle and still make the code work &#039;out of the box&#039;?</description>
		<content:encoded><![CDATA[<p>@lolo and @Hans. I would gladly fix init.rb right away, but before I do, help me out with this:</p>
<p>I really prefer if the plugin could be overwritten later with a recent version. And plugins work best if we can keep them pristine with no project specific changes. Therefore I wanted to be able to place the settings like L10N_LANG in more appropriate places.</p>
<p>Any suggestions on how I could honor that principle and still make the code work &#8216;out of the box&#8217;?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans</title>
		<link>http://justaddwater.dk/2008/01/13/rails-localization-plugin-release-version-09/comment-page-1/#comment-420708</link>
		<dc:creator>Hans</dc:creator>
		<pubDate>Tue, 27 May 2008 14:28:52 +0000</pubDate>
		<guid isPermaLink="false">http://justaddwater.dk/2008/01/13/rails-localization-plugin-release-version-09/#comment-420708</guid>
		<description>Iolo is correct. Init file should be changed to L10N_LANG = :languagecode in order to work

It is a great plugin, but I have some problem with using it as in the error messages the variable or attribute names are not translated.
I tried to do that by using my own version of full_messages incorporating localization translation method, but failed as I not know when and where you change from the original messsage to the translated
Any idea how to separate out the name of the attributes</description>
		<content:encoded><![CDATA[<p>Iolo is correct. Init file should be changed to L10N_LANG = :languagecode in order to work</p>
<p>It is a great plugin, but I have some problem with using it as in the error messages the variable or attribute names are not translated.<br />
I tried to do that by using my own version of full_messages incorporating localization translation method, but failed as I not know when and where you change from the original messsage to the translated<br />
Any idea how to separate out the name of the attributes</p>
]]></content:encoded>
	</item>
</channel>
</rss>

