Module: Jekyll::Localization

Defined in:
lib/jekyll/localization.rb,
lib/jekyll/localization/version.rb

Defined Under Namespace

Modules: LocalizedConvertible, Version

Constant Summary collapse

LANGUAGES =

The language codes that will be considered for translation

%w[en de fr]
HUMAN_LANGUAGES =

The language codes mapped to their human names

{
  'en' => %w[English Englisch    Anglais],
  'de' => %w[German  Deutsch     Allemand],
  'fr' => %w[French  Französisch Français]
}
I18N_LOCALES =

Path to I18n locale files (*.yml).

ENV['I18N_LOCALES'] || File.join(begin
  [Gem::Specification.find_by_name('rails-i18n').gem_dir, 'rails']
rescue LoadError
  __FILE__.chomp('.rb')
end, 'locale')
I18N =

Cache for I18n locale information.

Hash.new { |h, k|
  h[k] = YAML.load_file(File.join(I18N_LOCALES, "#{k}.yml"))[k] rescue nil
}
TIME_FMT =
i18n('time.formats.default').update(
  'en' => '%a %-d %b %Y %H:%M:%S %p %Z',
  'de' => '%a %-d %b %Y %H:%M:%S %Z'
)
DATE_FMT =

For backwards compatibility.

TIME_FMT
DATE_FMT_LONG =
i18n('date.formats.long').update(
  'en' => '%-d %B %Y',
  'de' => '%-d. %B %Y'
)
DATE_FMT_SHORT =
i18n('date.formats.short').update(
  'en' => '%-d %b %Y',
  'de' => '%-d. %b %Y'
)
MONTHNAMES =
i18n('date.month_names')
ABBR_MONTHNAMES =
i18n('date.abbr_month_names')
DAYNAMES =
i18n('date.day_names')
ABBR_DAYNAMES =
i18n('date.abbr_day_names')
MERIDIAN =
Hash.new { |h, k|
  h[k] = %w[am pm].map { |i| i18n("time.#{i}")[k] }
}.update(
  'en' => %w[AM PM]
)
LANG_EXT_RE =

What is considered a language extension

%r{\.([a-z]{2})}
LANG_END_RE =

The language extension, anchored at the end of the string

%r{#{Localization::LANG_EXT_RE}\z}
LANG_PARTS_RE =

Extract relevant parts from a file name

%r{\A(.*?)#{LANG_EXT_RE}\.(\w+)\z}
VERSION =
Version.to_s