diff options
author | Tsutomu Kuroda <t-kuroda@oiax.jp> | 2012-01-05 00:23:10 +0900 |
---|---|---|
committer | Tsutomu Kuroda <t-kuroda@oiax.jp> | 2012-01-05 11:08:09 +0900 |
commit | 22f901cc9db4603d775e4e0a96b0775ca08eebce (patch) | |
tree | d2906e6bf7769117e5dc88fdd93cf7bae5b2fb18 /actionpack/lib/action_view/helpers | |
parent | d268ef2f6599cd58cc27a8c9f0b9b6649f62e6a2 (diff) | |
download | rails-22f901cc9db4603d775e4e0a96b0775ca08eebce.tar.gz rails-22f901cc9db4603d775e4e0a96b0775ca08eebce.tar.bz2 rails-22f901cc9db4603d775e4e0a96b0775ca08eebce.zip |
Infer currency negative format from positive one.
When a locale file sets the format of the positive
currency value as '%n %u', the default negative
currency format should be '-%n %u'.
Cherry-picked from master (6724c8c8)
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r-- | actionpack/lib/action_view/helpers/number_helper.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/helpers/number_helper.rb b/actionpack/lib/action_view/helpers/number_helper.rb index 736e2cd57b..a325eb59dc 100644 --- a/actionpack/lib/action_view/helpers/number_helper.rb +++ b/actionpack/lib/action_view/helpers/number_helper.rb @@ -128,6 +128,7 @@ module ActionView defaults = I18n.translate(:'number.format', :locale => options[:locale], :default => {}) currency = I18n.translate(:'number.currency.format', :locale => options[:locale], :default => {}) + currency[:negative_format] ||= "-" + currency[:format] if currency[:format] defaults = DEFAULT_CURRENCY_VALUES.merge(defaults).merge!(currency) defaults[:negative_format] = "-" + options[:format] if options[:format] |