delocalize icon indicating copy to clipboard operation
delocalize copied to clipboard

Number parser failing with i18n fallbacks

Open airblade opened this issue 8 years ago • 1 comments

This is the same as #44. Here's a fix:

diff --git a/lib/delocalize/parsers/number.rb b/lib/delocalize/parsers/number.rb
index dc66eb9..bd2715c 100644
--- a/lib/delocalize/parsers/number.rb
+++ b/lib/delocalize/parsers/number.rb
@@ -7,7 +7,8 @@ class Number
       def parse(value)
         return value unless value.is_a?(String)

-        separator, delimiter = I18n.t([:separator, :delimiter], :scope => :'number.format')
+        separator = I18n.t(:separator, :scope => :'number.format')
+        delimiter = I18n.t(:delimiter, :scope => :'number.format')
         value.gsub(delimiter, '').gsub(separator, '.')
       end
     end

airblade avatar Apr 01 '16 10:04 airblade

Sorry for the super late response – I've overlooked the notification for the issue.

I'm happy to merge this if you open a PR that includes both the fix and a failing test case.

clemens avatar Jul 20 '16 16:07 clemens