FIX: Fallbacks for missing interpolation arguments

This takes effect when an interpolation is removed from a translation in
a Discourse update.

The I18n::Backend::Fallbacks loops with a catch(:exception), so calling
throw(:exception) will cause it to use the next locale, until it reaches
English which is assumed to be correct.

Also, enable fallbacks in everything except development (#3724 for more
discussion) - we should be able to test this
This commit is contained in:
Kane York 2015-09-11 09:25:03 -07:00
parent 3c9a818a2f
commit 6119d9fdc0
1 changed files with 5 additions and 3 deletions

View File

@ -28,8 +28,10 @@ class NoFallbackLocaleList < FallbackLocaleList
end
end
if Rails.env.production?
I18n.fallbacks = FallbackLocaleList.new
else
if Rails.env.development?
I18n.fallbacks = NoFallbackLocaleList.new
else
I18n.fallbacks = FallbackLocaleList.new
I18n.config.missing_interpolation_argument_handler = proc { throw(:exception) }
end