Module: RailsI18n::Pluralization::OneUptoTwoOther

Defined in:
lib/rails_i18n/common_pluralizations/one_upto_two_other.rb

Class Method Summary collapse

Class Method Details

.ruleObject



6
7
8
9
10
# File 'lib/rails_i18n/common_pluralizations/one_upto_two_other.rb', line 6

def self.rule
  lambda do |n|
    n.is_a?(Numeric) && n >= 0 && n < 2 ? :one : :other
  end
end

.with_locale(locale) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/rails_i18n/common_pluralizations/one_upto_two_other.rb', line 12

def self.with_locale(locale)
  { locale => {
      :'i18n' => {
        :plural => {
          :keys => [:one, :other],
          :rule => rule }}}}
end