Fix defaults for activerecord models in i18n
This commit is contained in:
parent
fd27fdc204
commit
f9bf34a73e
2 changed files with 3 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ module I18n
|
||||||
def translate(locale, key, options = {})
|
def translate(locale, key, options = {})
|
||||||
return super if options[:fallback]
|
return super if options[:fallback]
|
||||||
default = extract_string_or_lambda_default!(options) if options[:default]
|
default = extract_string_or_lambda_default!(options) if options[:default]
|
||||||
|
options.merge!(:default => default) if default
|
||||||
|
|
||||||
options[:fallback] = true
|
options[:fallback] = true
|
||||||
I18n.fallbacks[locale].each do |fallback|
|
I18n.fallbacks[locale].each do |fallback|
|
||||||
|
|
@ -16,7 +17,7 @@ module I18n
|
||||||
end
|
end
|
||||||
options.delete(:fallback)
|
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}"))
|
raise(I18n::MissingInterpolationArgument.new(options, "key: #{key} in locale: #{locale}"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
module I18n
|
module I18n
|
||||||
def self.just_raise_that_exception(*args)
|
def self.just_raise_that_exception(*args)
|
||||||
raise "Translation not found: #{args.first.key}"
|
raise "Translation not found: #{args.first.inspect}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue