Module: I18n::Locale::Tag

Defined in:
lib/i18n/locale/tag.rb,
lib/i18n/locale/tag/simple.rb,
lib/i18n/locale/tag/parents.rb,
lib/i18n/locale/tag/rfc4646.rb

Defined Under Namespace

Modules: Parents Classes: Rfc4646, Simple

Constant Summary collapse

RFC4646_SUBTAGS =
[ :language, :script, :region, :variant, :extension, :privateuse, :grandfathered ]
RFC4646_FORMATS =
{ :language => :downcase, :script => :capitalize, :region => :upcase, :variant => :downcase }

Class Method Summary collapse

Class Method Details

.implementationObject

Returns the current locale tag implementation. Defaults to I18n::Locale::Tag::Simple.



9
10
11
# File 'lib/i18n/locale/tag.rb', line 9

def implementation
  @@implementation ||= Simple
end

.implementation=(implementation) ⇒ Object

Sets the current locale tag implementation. Use this to set a different locale tag implementation.



14
15
16
# File 'lib/i18n/locale/tag.rb', line 14

def implementation=(implementation)
  @@implementation = implementation
end

.tag(tag) ⇒ Object

Factory method for locale tags. Delegates to the current locale tag implementation.



19
20
21
# File 'lib/i18n/locale/tag.rb', line 19

def tag(tag)
  implementation.tag(tag)
end