class R18n::Locales::Cy

Welsh locale

Public Instance Methods

format_date_full(date, year: true, **_kwargs) click to toggle source
# File lib/r18n-core/locales/cy.rb, line 43
def format_date_full(date, year: true, **_kwargs)
  format = full_format
  format = year_format.sub('_', format) if year
  strftime(date, format.sub('%e', ordinalize(date.mday)))
end
ordinalize(number) click to toggle source
# File lib/r18n-core/locales/cy.rb, line 32
def ordinalize(number)
  case number % 10
  when 1 then "#{number}af"
  when 2 then "#{number}il"
  when 3, 4 then "#{number}ydd"
  when 11, 13, 14, 16, 17, 19 then "#{number}eg"
  when 21..31 then "#{number}ain"
  else "#{number}ed"
  end
end