From ccd75cf98704752525717be721fe87c6dab203b8 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Fri, 30 Sep 2016 15:01:42 +0800 Subject: [PATCH] FIX: Ensure that the right locale exists before merging. --- lib/js_locale_helper.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/js_locale_helper.rb b/lib/js_locale_helper.rb index b44c07b7add..708bdc90642 100644 --- a/lib/js_locale_helper.rb +++ b/lib/js_locale_helper.rb @@ -7,7 +7,9 @@ module JsLocaleHelper translations = {} Dir["#{Rails.root}/plugins/*/config/locales/client.#{locale_str}.yml"].each do |file| - translations.deep_merge! YAML::load(File.open(file))[locale_str] + if plugin_translations = YAML::load(File.open(file))[locale_str] + translations.deep_merge!(plugin_translations) + end end translations