RailsI18n::Pluralization::EastSlavic

Public Class Methods

rule() click to toggle source
# File lib/rails_i18n/common_pluralizations/east_slavic.rb, line 9
def self.rule
  lambda do |n|
    mod10 = n % 10
    mod100 = n % 100

    if mod10 == 1 && mod100 != 11
      :one
    elsif [2, 3, 4].include?(mod10) && ![12, 13, 14].include?(mod100)
      :few
    elsif mod10 == 0 || (5..9).to_a.include?(mod10) || (11..14).to_a.include?(mod100)
      :many
    else
      :other
    end
  end
end
with_locale(locale) click to toggle source
# File lib/rails_i18n/common_pluralizations/east_slavic.rb, line 26
def self.with_locale(locale)
  { locale => {
      :'i18n' => {
        :plural => {
          :keys => [:one, :few, :many, :other],
          :rule => rule }}}}
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.