Hi there,

this a small patch fixing Globalize::Currency::parse, to not only parse US 
like currency strings. It uses now the Locale.active settings.
hadn't time to run any tests, so status is: 'it works for me' :)

Greetings,
Roland
[i'm not subscribed to this list, so please cc me]
--- vendor/plugins/globalize/lib/globalize/models/currency.rb.orig	2006-06-21 14:12:28.098807558 +0200
+++ vendor/plugins/globalize/lib/globalize/models/currency.rb	2006-06-21 14:35:17.373242456 +0200
@@ -148,7 +148,9 @@
       case
       when num.is_a?(String)
         raise ArgumentError, "Not an amount (#{num})" if num.delete("^0-9").empty?
-        _dollars, _cents = num.delete("^0-9.").split('.', 2)
+	_sep=(Locale.active.currency_decimal_sep || Locale.active.decimal_sep) if Locale.active?
+	_sep||='.'
+        _dollars, _cents = num.delete("^0-9"+_sep).split(_sep, 2)
         _cents = 0 if !_cents
         Currency.new(_dollars.to_i * 100 + _cents.to_i)
       when num.is_a?(Numeric)
_______________________________________________
Railsi18n-discussion mailing list
Railsi18n-discussion@rubyforge.org
http://rubyforge.org/mailman/listinfo/railsi18n-discussion

Reply via email to