Sha256: 4664b5bd1ab9ab3f92a28df035b035b66bb6fa27267cad0b7783d922f1134d0e

Contents?: true

Size: 646 Bytes

Versions: 27

Compression:

Stored size: 646 Bytes

Contents

module RailsI18n
  module Pluralization
    module Arabic
      def self.rule
        lambda do |n|
          n ||= 0
          mod100 = n % 100

          if n == 0
            :zero
          elsif n == 1
            :one
          elsif n == 2
            :two
          elsif (3..10).to_a.include?(mod100)
            :few
          elsif (11..99).to_a.include?(mod100)
            :many
          else
            :other
          end
        end
      end
    end
  end
end

{ :ar => {
    :'i18n' => {
      :plural => {
        :keys => [:zero, :one, :two, :few, :many, :other],
        :rule => RailsI18n::Pluralization::Arabic.rule }}}}

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
rails-i18n-7.0.6 rails/pluralization/ar.rb
rails-i18n-7.0.5 rails/pluralization/ar.rb
rails-i18n-7.0.3 rails/pluralization/ar.rb
rails-i18n-7.0.2 rails/pluralization/ar.rb
rails-i18n-7.0.1 rails/pluralization/ar.rb
rails-i18n-6.0.0 rails/pluralization/ar.rb
rails-i18n-6.0.0.beta1 rails/pluralization/ar.rb
rails-i18n-5.1.3 rails/pluralization/ar.rb
rails-i18n-5.1.2 rails/pluralization/ar.rb
rails-i18n-5.1.1 rails/pluralization/ar.rb
rails-i18n-5.1.0 rails/pluralization/ar.rb
rails-i18n-5.0.4 rails/pluralization/ar.rb
rails-i18n-5.0.3 rails/pluralization/ar.rb
rails-i18n-5.0.2 rails/pluralization/ar.rb
rails-i18n-5.0.1 rails/pluralization/ar.rb
rails-i18n-5.0.0 rails/pluralization/ar.rb
rails-i18n-4.0.9 rails/pluralization/ar.rb
rails-i18n-5.0.0.beta4 rails/pluralization/ar.rb
rails-i18n-5.0.0.beta3 rails/pluralization/ar.rb
rails-i18n-5.0.0.beta2 rails/pluralization/ar.rb