spree/spree — pull request #1885 by clemens (2012-08-26 16:27:15+00:00)
Title: Fix price parsing for localized prices

The existing code for parsing prices (see https://github.com/spree/spree/blob/master/core/app/models/spree/variant.rb#L55-66)
doesn't take into account entries for prices that use a different decimal separator than the full
stop ("."). This is true for almost all European and Latin American locales.

Example:
US: 15.99 = 15 dollars and 99 cents
Other: 15,99 = 15 dollars and 99 cents

If the product/variant edit form shows 15,99 (correct, because it uses `number_to_currency`) and
one presses save, the code linked above throws away the comma and saves it as 1599 and it gets
shown as 1.599,00 when the form is re-rendered (the full stop is the thousands delimiter here).
When one saves again, it gets saved as 1.60 (actually 1.599 but of course rounded).

This commit fixes the issues by taking into account locale settings for the decimal separator and
the thousand delimiter and replacing characters accordingly.