diff --git a/lib/i18n/backend/fallbacks.rb b/lib/i18n/backend/fallbacks.rb index 6cb36876..7a49fa2c 100644 --- a/lib/i18n/backend/fallbacks.rb +++ b/lib/i18n/backend/fallbacks.rb @@ -36,11 +36,11 @@ module Fallbacks # it is evaluated last after all the fallback locales have been tried. def translate(locale, key, options = {}) return super unless options.fetch(:fallback, true) - return super if (@fallback_locked ||= false) + return super if options[:fallback_in_progress] default = extract_non_symbol_default!(options) if options[:default] begin - @fallback_locked = true + options[:fallback_in_progress] = true I18n.fallbacks[locale].each do |fallback| begin catch(:exception) do @@ -52,7 +52,7 @@ def translate(locale, key, options = {}) end end ensure - @fallback_locked = false + options.delete(:fallback_in_progress) end return super(locale, nil, options.merge(:default => default)) if default diff --git a/lib/i18n/tests/localization/procs.rb b/lib/i18n/tests/localization/procs.rb index bdfa9480..de624888 100644 --- a/lib/i18n/tests/localization/procs.rb +++ b/lib/i18n/tests/localization/procs.rb @@ -72,7 +72,7 @@ def self.inspect_args(args) when ::Date arg.strftime('%a, %d %b %Y') when Hash - arg.delete(:fallback) + arg.delete(:fallback_in_progress) arg.inspect else arg.inspect diff --git a/lib/i18n/tests/procs.rb b/lib/i18n/tests/procs.rb index 02db95cb..aa2df19a 100644 --- a/lib/i18n/tests/procs.rb +++ b/lib/i18n/tests/procs.rb @@ -48,7 +48,7 @@ module Procs def self.filter_args(*args) - args.map {|arg| arg.delete(:fallback) if arg.is_a?(Hash) ; arg }.inspect + args.map {|arg| arg.delete(:fallback_in_progress) if arg.is_a?(Hash) ; arg }.inspect end end end