Skip to content

Commit

Permalink
Do not consider a plural node if it only has "other" with no count
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron committed Oct 26, 2018
1 parent c17c9d2 commit ab6e108
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/i18n/tasks/plural_keys.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,14 @@ def plural_nodes(tree)
end

def plural_forms?(s)
return false if non_plural_other?(s)
s.present? && s.all? { |node| node.leaf? && plural_suffix?(node.key) }
end

def non_plural_other?(s)
s.size == 1 && s.first.leaf? && s.first.key == 'other' && !s.first.value.include?('%{count}')
end

def plural_suffix?(key)
PLURAL_KEY_SUFFIXES.include?(key)
end
Expand Down

0 comments on commit ab6e108

Please sign in to comment.