Sha256: 935c4ce3a2966aed4184a90bcc5d7f106ae0b3ec8958f6244b0ed6f8834249fd

Contents?: true

Size: 1.21 KB

Versions: 8

Compression:

Stored size: 1.21 KB

Contents

{
  :'ru-RU' => {
    :pluralize => lambda { |n| 
      # Правило плюрализации для русского языка, взято из CLDR, http://unicode.org/cldr/
      #
      #
      # Russian language pluralization rules, taken from CLDR project, http://unicode.org/cldr/
      #
      #   one -> n mod 10 is 1 and n mod 100 is not 11;
      #   few -> n mod 10 in 2..4 and n mod 100 not in 12..14;
      #   many -> n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14;
      #   other -> everything else
      #
      # Пример
      #
      #   :one	= 1, 21, 31, 41, 51, 61...
      #   :few	= 2-4, 22-24, 32-34...
      #   :many = 0, 5-20, 25-30, 35-40...
      #   :other = 1.31, 2.31, 5.31...
      modulo10 = n.modulo(10)
      modulo100 = n.modulo(100)
      
      if modulo10 == 1 && modulo100 != 11
        :one
      elsif (modulo10 == 2 || modulo10 == 3 || modulo10 == 4) && !(modulo100 == 12 || modulo100 == 13 || modulo100 == 14)
        :few
      elsif modulo10 == 0 || (modulo10 == 5 || modulo10 == 6 || modulo10 == 7 || modulo10 == 8 || modulo10 == 9) || (modulo100 == 11 || modulo100 == 12 || modulo100 == 13 || modulo100 == 14)
        :many
      else
        :other
      end
    }
  }
}

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
yaroslav-russian-0.0.5 lib/russian/locale/pluralize.rb
yaroslav-russian-0.0.6 lib/russian/locale/pluralize.rb
yaroslav-russian-0.0.7 lib/russian/locale/pluralize.rb
yaroslav-russian-0.0.8 lib/russian/locale/pluralize.rb
russian-0.0.8 lib/russian/locale/pluralize.rb
russian-0.0.5 lib/russian/locale/pluralize.rb
russian-0.0.6 lib/russian/locale/pluralize.rb
russian-0.0.7 lib/russian/locale/pluralize.rb