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:
parent
73448e2e5f
commit
1399963eb0
2 changed files with 1 additions and 17 deletions
|
@ -76,7 +76,6 @@ end
|
||||||
|
|
||||||
begin
|
begin
|
||||||
require 'active_support/core_ext/hash/keys'
|
require 'active_support/core_ext/hash/keys'
|
||||||
require 'active_support/core_ext/hash/deep_merge'
|
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
class Hash
|
class Hash
|
||||||
def stringify_keys
|
def stringify_keys
|
||||||
|
@ -93,21 +92,6 @@ rescue LoadError
|
||||||
self
|
self
|
||||||
end if !{}.respond_to?(:symbolize_keys)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ module Sidekiq
|
||||||
settings.locales.each_with_object({}) do |path, global|
|
settings.locales.each_with_object({}) do |path, global|
|
||||||
find_locale_files(lang).each do |file|
|
find_locale_files(lang).each do |file|
|
||||||
strs = YAML.load(File.open(file))
|
strs = YAML.load(File.open(file))
|
||||||
global.deep_merge!(strs[lang])
|
global.merge!(strs[lang])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue