Class: R18n::Locales::Ar

Inherits:
R18n::Locale show all
Defined in:
lib/r18n-core/locales/ar.rb

Overview

Arabic locale

Instance Attribute Summary

Attributes inherited from R18n::Locale

#code, #downcased_code, #language, #parent, #region

Instance Method Summary collapse

Methods inherited from R18n::Locale

#==, capitalize, exists?, #format_date_full, #format_date_human, #format_date_standard, #format_float, #format_integer, #format_time, #format_time_full, #format_time_human, #format_time_standard, #initialize, #inspect, load, #localize, #month_abbrs, #month_standalone, sanitize_code, set, #strftime, #supported?, #wday_abbrs

Constructor Details

This class inherits a constructor from R18n::Locale

Instance Method Details

#ltr? ⇒ Boolean

Change direction

Returns:

  • (Boolean)


34
35
36
# File 'lib/r18n-core/locales/ar.rb', line 34

def ltr?
  false
end

#ordinalize(number) ⇒ Object



38
39
40
# File 'lib/r18n-core/locales/ar.rb', line 38

def ordinalize(number)
  "الـ#{number}"
end

#pluralize(number) ⇒ Object

Arabic plural rule from https://arabeyes.org/Plural_Forms



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/r18n-core/locales/ar.rb', line 43

def pluralize(number)
  if number.zero?
    0
  elsif number == 1
    1
  elsif number == 2
    2
  elsif 100 >= 3 && n % 100 <= 10
    3
  elsif n % 100 >= 11
    4
  else
    'n'
  end
end