Class: Locale::TagList

This provides the subclass of Array which behaves like the first(top priority) Locale::Tag object. "Locale.current.language" is same with "Locale.current[0].language".

Locale.current returns an Array of Tag(s) now. But the old Locale.current(Ruby-GetText) and Locale.get returns Locale::Object (similier with Locale::Tag::Posix). This is the class for backward compatibility.

It is recommanded to use Locale.current[0] or Locale.candidates to find the current locale instead of this function.

Public Instance Methods


charset ()

Returns the top priority charset. (posix)

    # File lib/locale/taglist.rb, line 44
44:     def charset
45:       if self[0].respond_to? :charset
46:         self[0].charset
47:       else
48:         ::Locale.driver_module.charset
49:       end
50:     end

country ()

Returns the top priority region/country. (simple)

    # File lib/locale/taglist.rb, line 32
32:     def country
33:       self[0].region
34:     end

extensions ()

Returns the top priority extensions.(common, rfc, cldr)

    # File lib/locale/taglist.rb, line 56
56:     def extensions
57:       (self[0].respond_to? :extensions) ? self[0].extensions : nil
58:     end

language ()

Returns the top priority language. (simple)

    # File lib/locale/taglist.rb, line 28
28:     def language
29:       self[0].language
30:     end

modifier ()

Returns the top priority modifier. (posix)

    # File lib/locale/taglist.rb, line 52
52:     def modifier
53:       (self[0].respond_to? :modifier) ? self[0].modifier : nil
54:     end

privateuse ()

Returns the top priority privateuse(rfc)

    # File lib/locale/taglist.rb, line 60
60:     def privateuse
61:       (self[0].respond_to? :privateuse) ? self[0].privateuse : nil
62:     end

region ()

Returns the top priority region/country. (simple)

    # File lib/locale/taglist.rb, line 36
36:     def region
37:       self[0].region
38:     end

script ()

Returns the top priority script. (common)

    # File lib/locale/taglist.rb, line 40
40:     def script
41:       self[0].script
42:     end

to_cldr ()

    # File lib/locale/taglist.rb, line 84
84:     def to_cldr
85:       self[0].to_cldr
86:     end

to_common ()

    # File lib/locale/taglist.rb, line 72
72:     def to_common
73:       self[0].to_common
74:     end

to_posix ()

    # File lib/locale/taglist.rb, line 88
88:     def to_posix
89:       self[0].to_posix
90:     end

to_rfc ()

    # File lib/locale/taglist.rb, line 80
80:     def to_rfc
81:       self[0].to_rfc
82:     end

to_s ()

    # File lib/locale/taglist.rb, line 68
68:     def to_s
69:       self[0].to_s
70:     end

to_simple ()

    # File lib/locale/taglist.rb, line 76
76:     def to_simple
77:       self[0].to_simple
78:     end

to_str ()

    # File lib/locale/taglist.rb, line 64
64:     def to_str
65:       self[0].to_str
66:     end