Object
Abstract language tag class. This class has
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
75: def initialize(language, region = nil)
76: raise "language can't be nil." unless language
77: @language, @region = language, region
78: @language = @language.downcase if @language
79: @region = @region.upcase if @region
80: end
Parse the language tag and return the new Locale::Tag::Simple.
# File lib/locale/tag/simple.rb, line 62
62: def parse(tag)
63: if tag =~ TAG_RE
64: ret = self.new($1, $2)
65: ret.tag = tag
66: ret
67: else
68: nil
69: end
70: end
# File lib/locale/tag/simple.rb, line 94
94: def <=>(other)
95: self.to_s <=> other.to_s
96: 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
138: def candidates
139: [self.class.new(language, region), self.class.new(language)]
140: end
For backward compatibility.
# File lib/locale/tag/simple.rb, line 118
118: def country; region end
Set the language (with downcase)
# File lib/locale/tag/simple.rb, line 121
121: def language=(val)
122: clear
123: @language = val
124: @language = @language.downcase if @language
125: @language
126: end
Return simple language tag which format
is”
# File lib/locale/tag/simple.rb, line 155
155: def to_string
156: s = @language.dup
157: s << "_" << @region if @region
158: s
159: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.