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.
Gets the charset of the locale.
# File lib/locale/base.rb, line 54 54: def charset 55: # locale parameter is ignored now. 56: system.charset 57: end
Gets the charset of the locale.
# File lib/locale/base.rb, line 26 26: def get_charset(locale) 27: locale.charset || @@default_locale.charset 28: end
Gets the system locale using setlocale and nl_langinfo.
# 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
Gets the system locale.
# File lib/locale/base.rb, line 47 47: def system 48: locale_from_env || default_locale 49: end