20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/jactive_support/localize.rb', line 20
def i18n_formatter(options = {})
format = options[:format] || :default
locale = options.fetch(:locale, ::I18n.locale)
if Symbol === format
key = format
options = options.merge(raise: true, object: self)
format = ::I18n.t("#{self.i18n_scope}.formats.#{key}", options)
end
if format.blank?
formatter = default_formatter(locale)
else
formatter = pattern_formatter(format, locale)
end
if options[:time_zone] && formatter.respond_to?(:time_zone)
formatter.time_zone = options[:time_zone].to_java_time_zone
end
formatter
end
|