From 6119d9fdc0d22a1b077c7be8db30b6d5c12a408f Mon Sep 17 00:00:00 2001 From: Kane York Date: Fri, 11 Sep 2015 09:25:03 -0700 Subject: [PATCH] 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 --- config/initializers/i18n.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/config/initializers/i18n.rb b/config/initializers/i18n.rb index 00dab6775c8..43b7299572e 100644 --- a/config/initializers/i18n.rb +++ b/config/initializers/i18n.rb @@ -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