-
Notifications
You must be signed in to change notification settings - Fork 264
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
Silence warnings for common leaf -> tree expansion scenario #314
Silence warnings for common leaf -> tree expansion scenario #314
Conversation
6083dd8
to
7131653
Compare
lib/i18n/tasks/data/tree/siblings.rb
Outdated
@@ -10,6 +10,9 @@ module I18n::Tasks::Data::Tree | |||
# in case of an empty parent (nil) it represents a forest | |||
# siblings' keys are unique | |||
class Siblings < Nodes # rubocop:disable Metrics/ClassLength | |||
# Ref: http://cldr.unicode.org/index/cldr-spec/plural-rules | |||
CLDR_CATEGORY_KEYS = %w[zero one two few many other].freeze |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could maybe reuse a similar definition from I18n::Tasks::PluralKeys
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored
dc5dc71
to
a22e6b1
Compare
81eb609
to
774c3d6
Compare
Build is green + rebased on latest |
lib/i18n/tasks/data/tree/siblings.rb
Outdated
def conditionally_warn_add_children_to_leaf(node, children) | ||
return unless @warn_about_add_children_to_leaf | ||
return if !children.empty? && | ||
(children.map(&:key) - I18n::Tasks::PluralKeys::CLDR_CATEGORY_KEYS).empty? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider exposing and reusing the following method here:
i18n-tasks/lib/i18n/tasks/plural_keys.rb
Line 50 in 774c3d6
def plural_forms?(s) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion! Refactored and added extra test to cover "internal node" situation
774c3d6
to
bc5673a
Compare
Closes glebm#242 Signed-off-by: Aleksandrs Ļedovskis <[email protected]>
bc5673a
to
a771f4c
Compare
@glebm Hello. The review's changes were applied, branch is rebased and build passes (JRuby failures are from upstream - ruby-i18n/i18n#447). Seems LGTM? |
@aleksandrs-ledovskis Sorry, it fell through the cracks |
@glebm Could you cut a new release with changes done since v0.9.28 ? |
@aleksandrs-ledovskis Released v0.9.29! |
Closes #242