class R18n::Locales::En

English locale

Public Instance Methods

format_date_full(date, year: true, **_kwargs) click to toggle source
# File lib/r18n-core/locales/en.rb, line 44
def format_date_full(date, year: true, **_kwargs)
  format = full_format
  format = year_format.sub('_', format) if year
  strftime(date, format.sub('%-d', ordinalize(date.mday)))
end
ordinalize(number) click to toggle source
# File lib/r18n-core/locales/en.rb, line 31
def ordinalize(number)
  if (11..13).cover?(number % 100)
    "#{number}th"
  else
    case number % 10
    when 1 then "#{number}st"
    when 2 then "#{number}nd"
    when 3 then "#{number}rd"
    else        "#{number}th"
    end
  end
end