BUGFIX: fallback to en translation when interpolation is missing

This commit is contained in:
Régis Hanol 2014-02-26 18:42:16 +01:00
parent 8167cefe36
commit 17f75bbe92

View file

@ -16,9 +16,17 @@ module I18n
k = [args, config.locale, config.backend.object_id]
t = @cache.fetch(k) { found = false }
unless found
t = @cache[k] = translate_no_cache(*args).freeze
begin
t = translate_no_cache(*args)
rescue MissingInterpolationArgument
options = args.last.is_a?(Hash) ? args.pop.dup : {}
options.merge!(locale: config.default_locale)
key = args.shift
t = translate_no_cache(key, options)
ensure
t = @cache[k] = t.freeze
end
end
t
end