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”.

  • Returns: the system charset.



35
36
37
38
39
40
41
42
43
44
# File 'lib/locale/driver/posix.rb', line 35

def charset
  charset = ::Locale::Driver::Env.charset
  unless charset
    charset = `locale charmap`.strip
    unless $? && $?.success?
      charset = "UTF-8"
    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.



28
29
30
# File 'lib/locale/driver/posix.rb', line 28

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