Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use separate trees per locale in missing_plural_forest #311

Merged
merged 1 commit into from
Oct 27, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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