Module: Bridgetown::Filters::LocalizationFilters

Included in:
Bridgetown::Filters, Tags::LocalizationTag
Defined in:
bridgetown-core/lib/bridgetown-core/filters/localization_filters.rb

Instance Method Summary collapse

Instance Method Details

#l(input, format = nil, locale = nil) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'bridgetown-core/lib/bridgetown-core/filters/localization_filters.rb', line 6

def l(input, format = nil, locale = nil)
  date = Liquid::Utils.to_date(input)
  return input if date.nil?

  format = maybe_symbolized(format, date)
  locale ||= maybe_locale(format)
  format = nil if locale == format

  I18n.l(date, format:, locale:)
end