Class Locale::Tag::Simple
In: lib/locale/tag/simple.rb
Parent: Object

Abstract language tag class. This class has <language>, <region> which all of language tag specifications have.

  • ja (language: ISO 639 (2 or 3 alpha))
  • ja_JP (country: RFC4646 (ISO3166/UN M.49) (2 alpha or 3 digit)
  • ja-JP
  • ja-392

Methods

<=>   candidates   country   language=   new   parse   region=   to_s  

Constants

ALPHA = '[a-z]'
DIGIT = '[0-9]'
ALPHANUM = "[a-zA-Z0-9]"
LANGUAGE = "(#{ALPHA}{2,3})"
REGION = "(#{ALPHA}{2}|#{DIGIT}{3})"
TAG_RE = /\A#{LANGUAGE}(?:[_-]#{REGION})?\Z/i

Attributes

language  [R] 
region  [R] 
tag  [RW]  tag is set when .parse method is called. This value is used when the program want to know the original String.

Public Class methods

Parse the language tag and return the new Locale::Tag::Simple.

Public Instance methods

Returns an Array of tag-candidates order by priority. Use Locale.candidates instead of this method.

For backward compatibility.

Set the language (with downcase)

Set the region (with upcase)

Returns the language tag as the String.

  <language>_<REGION>
  (e.g.) "ja_JP"

[Validate]