12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/date_values/rails/i18n_backend.rb', line 12
def localize(locale, object, format = :default, options = EMPTY_HASH)
type = TYPES[object.class]
return super unless type
format_key = format.is_a?(Symbol) ? format : nil
if format_key
entry = I18n.t("#{type}.formats.#{format_key}", locale: locale, default: nil)
raise I18n::MissingTranslationData.new(locale, "#{type}.formats.#{format_key}") unless entry
format = entry
end
object.strftime(format)
end
|