Module: Locale::SystemPosix
- Extended by:
- System
- Defined in:
- lib/gettext/locale_posix.rb
Overview
Locale::SystemPosix module for Posix OS (Unix) This is a low-level class. Application shouldn’t use this directly.
Constant Summary collapse
Constants included from System
Locale::System::ALL, Locale::System::COLLATE, Locale::System::CTYPE, Locale::System::MESSAGES, Locale::System::MONETARY, Locale::System::NUMERIC, Locale::System::TIME
Class Method Summary collapse
-
.get_charset(locale) ⇒ Object
Gets the charset of the locale.
-
.system ⇒ Object
Gets the system locale using setlocale and nl_langinfo.
Methods included from System
Class Method Details
.get_charset(locale) ⇒ Object
Gets the charset of the locale.
-
locale: Locale::Object
-
Returns: the charset of the locale
39 40 41 42 43 44 45 |
# File 'lib/gettext/locale_posix.rb', line 39 def get_charset(locale) old = set(Locale::System::CTYPE, nil) set(Locale::System::CTYPE, locale.orig_str) ret = codeset set(Locale::System::CTYPE, old) ret end |
.system ⇒ Object
Gets the system locale using setlocale and nl_langinfo.
-
Returns the system locale (Locale::Object).
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/gettext/locale_posix.rb', line 23 def system locale = nil [ENV["LC_ALL"], ENV["LC_MESSAGES"], ENV["LANG"], @@default_locale.orig_str].each do |loc| if loc != nil and loc.size > 0 locale = Locale::Object.new(loc) locale.charset = get_charset(locale) break end end locale end |