Module: RailsAdmin::Support::I18n

Included in:
ApplicationHelper, Datetime
Defined in:
lib/rails_admin/support/i18n.rb

Instance Method Summary collapse

Instance Method Details

#abbr_day_namesObject



6
7
8
9
10
# File 'lib/rails_admin/support/i18n.rb', line 6

def abbr_day_names
  ::I18n.t('date.abbr_day_names', raise: true)
rescue ::I18n::ArgumentError
  ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
end

#abbr_month_namesObject



12
13
14
15
16
17
18
19
# File 'lib/rails_admin/support/i18n.rb', line 12

def abbr_month_names
  begin
    names = ::I18n.t('date.abbr_month_names', raise: true)
  rescue ::I18n::ArgumentError
    names = [nil, "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  end
  names[1..-1]
end

#date_formatObject



21
22
23
24
25
# File 'lib/rails_admin/support/i18n.rb', line 21

def date_format
  ::I18n.t('date.formats.default', raise: true)
rescue
  "%Y-%m-%d"
end

#day_namesObject



27
28
29
30
31
# File 'lib/rails_admin/support/i18n.rb', line 27

def day_names
  ::I18n.t('date.day_names', raise: true)
rescue ::I18n::ArgumentError
  ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
end

#month_namesObject



33
34
35
36
37
38
39
40
# File 'lib/rails_admin/support/i18n.rb', line 33

def month_names
  begin
    names = ::I18n.t('date.month_names', raise: true)
  rescue ::I18n::ArgumentError
    names = [nil, "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
  end
  names[1..-1]
end