Module: RailsI18n::Pluralization::Lithuanian

Defined in:
lib/rails_i18n/pluralization.rb

Class Method Summary collapse

Class Method Details

.ruleObject



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/rails_i18n/pluralization.rb', line 65

def self.rule
  lambda do |n|
    return :other unless n.is_a?(Numeric)

    mod10 = n % 10
    mod100 = n % 100

    if mod10 == 1 && !(11..19).to_a.include?(mod100)
      :one
    elsif (2..9).to_a.include?(mod10) && !(11..19).to_a.include?(mod100)
      :few
    else
      :other
    end
  end
end