1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

It turns out that a deep merge isn’t required, #3474

All locale files are a top-level locale key with a Hash of (key, string) translations, nothing more iirc.
This commit is contained in:
Mike Perham 2017-05-12 21:14:00 -07:00
parent 73448e2e5f
commit 1399963eb0
2 changed files with 1 additions and 17 deletions

View file

@ -76,7 +76,6 @@ end
begin
require 'active_support/core_ext/hash/keys'
require 'active_support/core_ext/hash/deep_merge'
rescue LoadError
class Hash
def stringify_keys
@ -93,21 +92,6 @@ rescue LoadError
self
end if !{}.respond_to?(:symbolize_keys)
def deep_merge(other_hash, &block)
dup.deep_merge!(other_hash, &block)
end if !{}.respond_to?(:deep_merge)
def deep_merge!(other_hash, &block)
other_hash.each_pair do |k,v|
tv = self[k]
if tv.is_a?(Hash) && v.is_a?(Hash)
self[k] = tv.deep_merge(v, &block)
else
self[k] = block && tv ? block.call(k, tv, v) : v
end
end
self
end if !{}.respond_to?(:deep_merge!)
end
end

View file

@ -15,7 +15,7 @@ module Sidekiq
settings.locales.each_with_object({}) do |path, global|
find_locale_files(lang).each do |file|
strs = YAML.load(File.open(file))
global.deep_merge!(strs[lang])
global.merge!(strs[lang])
end
end
end