Module: RailsI18n::Pluralization::ScottishGaelic

Defined in:
lib/rails_i18n/pluralization.rb

Class Method Summary collapse

Class Method Details

.ruleObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/rails_i18n/pluralization.rb', line 28

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

    floorn = n.floor

    if floorn == 1 || floorn == 11
      :one
    elsif floorn == 2 || floorn == 12
      :two
    elsif (3..19).member?(floorn)
      :few
    else
      :other
    end
  end
end