Module | Locale::SystemBase
In: | lib/locale/base.rb

Locale::SystemBase module. This module overrides from other concrete modules. This is a low-level class. Application shouldn‘t use this directly.

### Methods

charset get_charset locale_from_env system

### Public Instance methods

charset()

Gets the charset of the locale.

- locale: Locale::Object
- Returns: the charset of the locale

[Source]

        # File lib/locale/base.rb, line 54
    54:     def charset
    55:       # locale parameter is ignored now.
    56:       system.charset
    57:     end

get_charset(locale)

Gets the charset of the locale.

- locale: Locale::Object
- Returns the charset of the locale

[Source]

        # File lib/locale/base.rb, line 26
    26:     def get_charset(locale)
    27:       locale.charset || @@default_locale.charset
    28:     end

locale_from_env()

Gets the system locale using setlocale and nl_langinfo.

- Returns the system locale (Locale::Object).

[Source]

        # File lib/locale/base.rb, line 32
    32:     def locale_from_env
    33:       locale = nil
    34:       # At least one environment valiables should be set on *nix system.
    35:       [ENV["LC_ALL"], ENV["LC_MESSAGES"], ENV["LANG"]].each do |loc|
    36:         if loc != nil and loc.size > 0
    37:           locale = Locale::Object.new(loc)
    38:           locale.charset ||= get_charset(locale)
    39:           break
    40:         end
    41:       end
    42:       locale
    43:     end

system()

Gets the system locale.

- Returns the system locale (Locale::Object)

[Source]

        # File lib/locale/base.rb, line 47
    47:     def system
    48:       locale_from_env || default_locale
    49:     end

[Validate]