From 84816ae981a8598e5e401eb1b9b805de840fefc9 Mon Sep 17 00:00:00 2001 From: Sven Fuchs Date: Sun, 6 Jul 2008 21:20:02 +0200 Subject: align with changes in i18n --- actionpack/lib/action_view/helpers/date_helper.rb | 5 ++--- actionpack/lib/action_view/helpers/number_helper.rb | 2 +- actionpack/lib/action_view/helpers/translation_helper.rb | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) (limited to 'actionpack/lib/action_view') diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index d306c7a742..61fff42d5a 100755 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -504,7 +504,6 @@ module ActionView # def select_month(date, options = {}, html_options = {}) locale = options[:locale] - locale ||= self.locale if respond_to?(:locale) val = date ? (date.kind_of?(Fixnum) ? date : date.month) : '' if options[:use_hidden] @@ -513,7 +512,7 @@ module ActionView month_options = [] month_names = options[:use_month_names] || begin key = options[:use_short_month] ? :'date.abbr_month_names' : :'date.month_names' - I18n.translate key, locale + I18n.translate key, :locale => locale end month_names.unshift(nil) if month_names.size < 13 @@ -633,7 +632,7 @@ module ActionView position = { :year => 1, :month => 2, :day => 3, :hour => 4, :minute => 5, :second => 6 } - order = options[:order] ||= I18n.translate(:'date.order', locale) + order = options[:order] ||= I18n.translate(:'date.order', :locale => locale) # Discard explicit and implicit by not being included in the :order discard = {} diff --git a/actionpack/lib/action_view/helpers/number_helper.rb b/actionpack/lib/action_view/helpers/number_helper.rb index 981589437d..6bb8263794 100644 --- a/actionpack/lib/action_view/helpers/number_helper.rb +++ b/actionpack/lib/action_view/helpers/number_helper.rb @@ -70,7 +70,7 @@ module ActionView # # => 1234567890,50 £ def number_to_currency(number, options = {}) options = options.symbolize_keys - defaults = I18n.translate(:'currency.format', options[:locale]) || {} + defaults = I18n.translate(:'currency.format', :locale => options[:locale]) || {} precision = options[:precision] || defaults[:precision] unit = options[:unit] || defaults[:unit] diff --git a/actionpack/lib/action_view/helpers/translation_helper.rb b/actionpack/lib/action_view/helpers/translation_helper.rb index 0bfe6bf771..c13c2dfc04 100644 --- a/actionpack/lib/action_view/helpers/translation_helper.rb +++ b/actionpack/lib/action_view/helpers/translation_helper.rb @@ -4,11 +4,11 @@ module ActionView module Helpers module TranslationHelper def translate(*args) - key, locale, options = I18n.send :process_translate_arguments, *args - I18n.translate key, locale, options.merge(:raise => true) + args << args.extract_options!.merge(:raise => true) + I18n.translate *args rescue I18n::MissingTranslationData => e - keys = I18n.send :normalize_translation_keys, locale, key, options[:scope] + keys = I18n.send :normalize_translation_keys, e.locale, e.key, e.options[:scope] content_tag('span', keys.join(', '), :class => 'translation_missing') end end -- cgit v1.2.3