Create Locale::Tag::Cldr.
variants should be upcase.
# File lib/locale/tag/cldr.rb, line 58 58: def initialize(language, script = nil, region = nil, 59: variants = [], extensions = {}) 60: @extensions = extensions 61: super(language, script, region, variants.map{|v| v.upcase}) 62: end
Parse the language tag and return the new Locale::Tag::CLDR.
# File lib/locale/tag/cldr.rb, line 31 31: def parse(tag) 32: if tag =~ /\APOSIX\Z/ # This is the special case of POSIX locale but match this regexp. 33: nil 34: elsif tag =~ TAG_RE 35: lang, script, region, subtag = $1, $2, $3, $4 36: 37: extensions = {} 38: subtag.scan(/#{EXTENSION}/).each{|v| 39: subtag.sub!(v, "") 40: key, type = v.split("=") 41: extensions[key] = type 42: } 43: variants = subtag.scan(/#{VARIANT}/).collect{|v| v[0].upcase} 44: 45: ret = self.new(lang, script, region, variants, extensions) 46: ret.tag = tag 47: ret 48: else 49: nil 50: end 51: end
Returns the language tag. (e.g.) “ja_Hira_JP_VARIANT1_VARIANT2@foo1=var1;foo2=var2“
This is used in internal only. Use to_s instead.
# File lib/locale/tag/cldr.rb, line 90 90: def to_string 91: s = super 92: if @extensions.size > 0 93: s << "@" << @extensions.to_a.sort.map{|k, v| "#{k}=#{v}"}.join(";") 94: end 95: s 96: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.