From 22f901cc9db4603d775e4e0a96b0775ca08eebce Mon Sep 17 00:00:00 2001 From: Tsutomu Kuroda Date: Thu, 5 Jan 2012 00:23:10 +0900 Subject: 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) --- actionpack/lib/action_view/helpers/number_helper.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'actionpack/lib/action_view/helpers/number_helper.rb') 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] -- cgit v1.2.3