Class: R18n::Locales::Fa

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

Overview

Persian 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_time, #format_time_full, #format_time_human, #format_time_standard, #initialize, #inspect, load, #localize, #month_abbrs, #month_standalone, #pluralize, sanitize_code, set, #supported?, #wday_abbrs

Constructor Details

This class inherits a constructor from R18n::Locale

Instance Method Details

#format_float(integer) ⇒ Object

Change numerals to Persian



41
42
43
# File 'lib/r18n-core/locales/fa.rb', line 41

def format_float(integer)
  persian_numerals super
end

#format_integer(integer) ⇒ Object

Change numerals to Persian



36
37
38
# File 'lib/r18n-core/locales/fa.rb', line 36

def format_integer(integer)
  persian_numerals super
end

#ltr?Boolean

Change direction

Returns:

  • (Boolean)


31
32
33
# File 'lib/r18n-core/locales/fa.rb', line 31

def ltr?
  false
end

#persian_numerals(str) ⇒ Object

Replace western numerals to Persian



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/r18n-core/locales/fa.rb', line 51

def persian_numerals(str)
  str
    .tr('0', '۰')
    .tr('1', '۱')
    .tr('2', '۲')
    .tr('3', '۳')
    .tr('4', '۴')
    .tr('5', '۵')
    .tr('6', '۶')
    .tr('7', '۷')
    .tr('8', '۸')
    .tr('9', '۹')
end

#strftime(time, format) ⇒ Object

Change numerals to Persian



46
47
48
# File 'lib/r18n-core/locales/fa.rb', line 46

def strftime(time, format)
  persian_numerals super
end