[DRE-commits] r5512 - in trunk/libgettext-activerecord-ruby/debian: . patches

Gunnar Wolf gwolf at alioth.debian.org
Sun Jun 6 01:03:39 UTC 2010


Author: gwolf
Date: 2010-06-06 01:03:30 +0000 (Sun, 06 Jun 2010)
New Revision: 5512

Added:
   trunk/libgettext-activerecord-ruby/debian/patches/
   trunk/libgettext-activerecord-ruby/debian/patches/series
   trunk/libgettext-activerecord-ruby/debian/patches/validations_format_string
Log:
Fixed incomplete format string handling

Added: trunk/libgettext-activerecord-ruby/debian/patches/series
===================================================================
--- trunk/libgettext-activerecord-ruby/debian/patches/series	                        (rev 0)
+++ trunk/libgettext-activerecord-ruby/debian/patches/series	2010-06-06 01:03:30 UTC (rev 5512)
@@ -0,0 +1 @@
+validations_format_string

Added: trunk/libgettext-activerecord-ruby/debian/patches/validations_format_string
===================================================================
--- trunk/libgettext-activerecord-ruby/debian/patches/validations_format_string	                        (rev 0)
+++ trunk/libgettext-activerecord-ruby/debian/patches/validations_format_string	2010-06-06 01:03:30 UTC (rev 5512)
@@ -0,0 +1,30 @@
+From: Gunnar Wolf <gwolf at debian.org
+Bug: http://rubyforge.org/tracker/index.php?func=detail&aid=28280&group_id=855&atid=3377
+Forwarded: yes
+Last-Update: 2010-06-05
+Description: Incomplete substitution on strings in localize_error_message (validations.rb)
+ This patch fixes an incomplete hash being given to the format string,
+ which caused some strings to raise an exception.
+===================================================================
+--- libgettext-activerecord-ruby-2.1.0.orig/lib/gettext_activerecord/validations.rb	2010-06-05 19:54:08.000000000 -0500
++++ libgettext-activerecord-ruby-2.1.0/lib/gettext_activerecord/validations.rb	2010-06-05 19:54:55.000000000 -0500
+@@ -163,16 +163,15 @@
+       msgstr = @base.gettext(msgid)
+       msgstr = _(msgid) if msgstr == msgid 
+       msgstr = msgstr.gsub("%{fn}", "%{attribute}").gsub("%d", "%{count}").gsub("%{val}", "%{value}")  # for backward compatibility.
++      attrname = @base.class.human_attribute_name(attr)
+       if attr == "base"
+         full_message = msgstr
+-      elsif /%\{attribute\}/ =~ msgstr
+-        full_message = msgstr % {:attribute => @base.class.human_attribute_name(attr)}
+       elsif append_field
+-        full_message = @base.class.human_attribute_name(attr) + " " + msgstr
++        full_message = attrname + " " + msgstr
+       else
+         full_message = msgstr
+       end
+-      full_message % {:count => count, :value => value}
++      full_message % {:count => count, :value => value, :attribute => attrname}
+     end
+ 
+     def localize_error_messages(append_field = true) # :nodoc:




More information about the Pkg-ruby-extras-commits mailing list