From 8ca5aad1e2b1612c2ef6824bd574eea9ef71d30d Mon Sep 17 00:00:00 2001 From: Dan Ungureanu Date: Sat, 26 Oct 2019 12:55:54 +0300 Subject: [PATCH] FIX: Reload plugin translations in development (#8243) The default locale is :en_US, which is just a thin layer over :en. In other words, :en_US has the :en locale as a fallback. When "en.yml" is edited, only the :en locale is refreshed and :en_US becomes stale. This commit ensures that there is a dependency on the fallback locales too. --- lib/js_locale_helper.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/js_locale_helper.rb b/lib/js_locale_helper.rb index 52a6c93d30c..798a67fe87b 100644 --- a/lib/js_locale_helper.rb +++ b/lib/js_locale_helper.rb @@ -6,10 +6,12 @@ module JsLocaleHelper Dir["#{Rails.root}/plugins/*/config/locales/client.#{locale_str}.yml"] end - def self.reloadable_plugins(locale, ctx) + def self.reloadable_plugins(locale_sym, ctx) return unless Rails.env.development? - plugin_client_files(locale.to_s).each do |file| - ctx.depend_on(file) + I18n.fallbacks[locale_sym].each do |locale| + plugin_client_files(locale.to_s).each do |file| + ctx.depend_on(file) + end end end