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
Create a Locale::Tag::Simple
# File lib/locale/tag/simple.rb, line 75 def initialize(language, region = nil) raise "language can't be nil." unless language @language, @region = language, region @language = @language.downcase if @language @region = @region.upcase if @region end
Parse the language tag and return the new Locale::Tag::Simple.
# File lib/locale/tag/simple.rb, line 62 def parse(tag) if tag =~ TAG_RE ret = self.new($1, $2) ret.tag = tag ret else nil end end
# File lib/locale/tag/simple.rb, line 94 def <=>(other) self.to_s <=> other.to_s end
Returns an Array of tag-candidates order by priority. Use Locale.candidates instead of this method.
# File lib/locale/tag/simple.rb, line 138 def candidates [self.class.new(language, region), self.class.new(language)] end
For backward compatibility.
# File lib/locale/tag/simple.rb, line 118 def country; region end
Set the language (with downcase)
# File lib/locale/tag/simple.rb, line 121 def language=(val) clear @language = val @language = @language.downcase if @language @language end
Generated with the Darkfish Rdoc Generator 2.