lib/i18n/tasks/missing_keys.rb in i18n-tasks-0.9.33 vs lib/i18n/tasks/missing_keys.rb in i18n-tasks-0.9.34
- old
+ new
@@ -58,15 +58,17 @@
def missing_plural_forest(locales, _base = base_locale)
locales.each_with_object(empty_forest) do |locale, forest|
required_keys = required_plural_keys_for_locale(locale)
next if required_keys.empty?
+
tree = empty_forest
plural_nodes data[locale] do |node|
children = node.children
present_keys = Set.new(children.map { |c| c.key.to_sym })
next if present_keys.superset?(required_keys)
+
tree[node.full_key] = node.derive(
value: children.to_hash,
children: nil,
data: node.data.merge(missing_keys: (required_keys - present_keys).to_a)
)
@@ -130,9 +132,10 @@
to_remove = []
forest.each do |root|
locale = root.key
root.keys do |key, node|
next unless yield node
+
if locales_and_node_by_key.key?(key)
locales_and_node_by_key[key][0] << locale
else
locales_and_node_by_key[key] = [[locale], node]
end