File: i18n.rb

package info (click to toggle)
ruby-rails-admin 0.8.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,492 kB
  • ctags: 1,292
  • sloc: ruby: 5,341; makefile: 3
file content (41 lines) | stat: -rw-r--r-- 1,042 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
require 'i18n'

module RailsAdmin
  module Support
    module I18n
      def abbr_day_names
        ::I18n.t('date.abbr_day_names', raise: true)
      rescue ::I18n::ArgumentError
        ::I18n.t('date.abbr_day_names', locale: :en)
      end

      def abbr_month_names
        begin
          names = ::I18n.t('date.abbr_month_names', raise: true)
        rescue ::I18n::ArgumentError
          names = ::I18n.t('date.abbr_month_names', locale: :en)
        end
        names[1..-1]
      end

      def date_format
        ::I18n.t('date.formats.default', default: ::I18n.t('date.formats.default', locale: :en))
      end

      def day_names
        ::I18n.t('date.day_names', raise: true)
      rescue ::I18n::ArgumentError
        ::I18n.t('date.day_names', locale: :en)
      end

      def month_names
        begin
          names = ::I18n.t('date.month_names', raise: true)
        rescue ::I18n::ArgumentError
          names = ::I18n.t('date.month_names', locale: :en)
        end
        names[1..-1]
      end
    end
  end
end