Module: Jekyll::I18nFilter
- Defined in:
- lib/jekyll-date-localization.rb
Instance Method Summary collapse
Instance Method Details
#load_translations ⇒ Object
15 16 17 18 19 20 |
# File 'lib/jekyll-date-localization.rb', line 15 def load_translations unless I18n::backend.instance_variable_get(:@translations) I18n.backend.load_translations \ Dir[File.join(File.dirname(__FILE__),'locales/*.yml')] + Dir['_locales/*.yml'] end end |
#localize(input, format = nil, locale = nil) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/jekyll-date-localization.rb', line 6 def localize(input, format=nil, locale=nil) load_translations locale = locale || @context.registers[:site].config["date_locale"] if input.is_a?(String) input = DateTime.parse(input) end I18n.l input, :format => format, :locale => locale end |