delocalize
delocalize copied to clipboard
Number parser failing with i18n fallbacks
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
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.