Skip to content

Commit

Permalink
Use separate trees per locale in missing_plural_forest
Browse files Browse the repository at this point in the history
Otherwise the root key, which is the locale displayed in the report,
is set to the last processed locale

Fix glebm#310
  • Loading branch information
Gargron committed Oct 26, 2018
1 parent c17c9d2 commit ef7ca80
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/i18n/tasks/missing_keys.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ def missing_used_forest(locales, _base = base_locale)
end

def missing_plural_forest(locales, _base = base_locale)
locales.each_with_object(empty_forest) do |locale, tree|
locales.each_with_object(empty_forest) do |locale, forest|
next unless I18n.exists?(:'i18n.plural.keys', locale)
required_keys = Set.new(I18n.t(:'i18n.plural.keys', locale: locale, resolve: false))
tree = empty_forest
plural_nodes data[locale] do |node|
children = node.children
present_keys = Set.new(children.map { |c| c.key.to_sym })
Expand All @@ -71,6 +72,7 @@ def missing_plural_forest(locales, _base = base_locale)
)
end
tree.set_root_key!(locale, type: :missing_plural)
forest.merge!(tree)
end
end

Expand Down

0 comments on commit ef7ca80

Please sign in to comment.