Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

[PATCH] number_to_currency should take configured format for default negative format

#6653

By resolved ticket #5894 number_to_currency doesn't format negative numbers correctly number_to_currency compose default :negative_format only from options sent to method or takes it from DEFAULT_CURRENCY_VALUES.

I think, it should also consider format specified in I18n.translate(:'number.currency.format')

For example, gem Russian specify ru.number.currency.format as %n %u so that number_to_currency(10)=='10,00 rur'.
But for negative values DEFAULT_CURRENCY_VALUES[:negative_values_format] is used, so that number_to_currency(-10)=='-rur.10,00' which is wrong.
If negative format were taken as '-' + currency[:format] then formatted value will be '-10,00 rur.' which is right.

Patch below.

Reported by Sokolov Yura · March 30th, 2011 @ 07:24 PM

State: new
Milestone: none
Assigned to: nobody
Importance: none