Module: RailsI18n::Pluralization::OneTwoOther

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

Class Method Summary collapse

Class Method Details

.ruleObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rails_i18n/common_pluralizations/one_two_other.rb', line 7

def self.rule
  def self.rule
    lambda do |n|
      if n == 1
        :one
      elsif n == 2
        :two
      else
        :other
      end
    end
  end
end

.with_locale(locale) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/rails_i18n/common_pluralizations/one_two_other.rb', line 21

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