Class: Jekyll::L10n::LocaleUrlFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll-l10n/utils/locale_url_formatter.rb

Overview

Converts a canonical (gettext/POSIX-style) locale identifier, e.g. "es_ES", into the BCP 47 form used in generated URLs and hrefs, e.g. "es-es". Lowercased per RFC 5646 ss2.1.1 (subtag case carries no meaning; this is a display-convention choice, not a standard requirement). Idempotent.

Class Method Summary collapse

Class Method Details

.to_url_segment(locale) ⇒ Object



10
11
12
# File 'lib/jekyll-l10n/utils/locale_url_formatter.rb', line 10

def self.to_url_segment(locale)
  locale.to_s.tr('_', '-').downcase
end