Sha256: 2a9686760f5abe568da4e9e58dbdb3defc8d2f038f0383985241a342f32c2752

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_admin-0.8.1 lib/rails_admin/support/i18n.rb