FIX: Ensure that the right locale exists before merging.

This commit is contained in:
Guo Xiang Tan 2016-09-30 15:01:42 +08:00
parent 1c3992e575
commit ccd75cf987
1 changed files with 3 additions and 1 deletions

View File

@ -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