Module: Locale::Driver::Posix

Defined in:
lib/locale/driver/posix.rb

Class Method Summary collapse

Class Method Details

.charsetObject

Gets the charset from environment variable or the result of “locale charmap” or nil.

  • Returns: the system charset.



43
44
45
46
47
48
49
50
51
52
# File 'lib/locale/driver/posix.rb', line 43

def charset
  charset = ::Locale::Driver::Env.charset
  unless charset
    charset = `locale charmap`.strip
    unless $? && $?.success?
      charset = nil
    end
  end
  charset
end

.localesObject

Gets the locales from environment variables. (LANGUAGE > LC_ALL > LC_MESSAGES > LANG) Only LANGUAGE accept plural languages such as “nl_BE;

  • Returns: an Array of the locale as Locale::Tag::Posix or nil.



36
37
38
# File 'lib/locale/driver/posix.rb', line 36

def locales
  ::Locale::Driver::Env.locales
end