Module: MiniI18n::Localization

Extended by:
Localization
Included in:
MiniI18n, Localization
Defined in:
lib/mini_i18n/localization.rb

Constant Summary collapse

DELIMITER_REGEX =
/\d(?=(\d{3})+(?!\d))/
DAYS_MONTHS_REGEX =
/%[aAbB]/

Instance Method Summary collapse

Instance Method Details

#localize(object, options = {}) ⇒ Object Also known as: l


10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/mini_i18n/localization.rb', line 10

def localize(object, options = {})
  case object
  when Numeric
    localize_number(object, options)
  when Date
    localize_datetime(object, options.merge(type: :date))
  when Time, DateTime
    localize_datetime(object, options.merge(type: :time))
  when String
    localize_string(object, options)
  end
end