Fix defaults for activerecord models in i18n

This commit is contained in:
Raphael Sofaer 2011-07-29 15:51:03 -07:00
parent fd27fdc204
commit f9bf34a73e
2 changed files with 3 additions and 2 deletions

View file

@ -5,6 +5,7 @@ module I18n
def translate(locale, key, options = {})
return super if options[:fallback]
default = extract_string_or_lambda_default!(options) if options[:default]
options.merge!(:default => default) if default
options[:fallback] = true
I18n.fallbacks[locale].each do |fallback|
@ -16,7 +17,7 @@ module I18n
end
options.delete(:fallback)
return super(locale, nil, options.merge(:default => default)) if default
return super(locale, nil, options) if default
raise(I18n::MissingInterpolationArgument.new(options, "key: #{key} in locale: #{locale}"))
end
end

View file

@ -1,6 +1,6 @@
module I18n
def self.just_raise_that_exception(*args)
raise "Translation not found: #{args.first.key}"
raise "Translation not found: #{args.first.inspect}"
end
end