Module: Locale::Driver::Win32
- Includes:
- Win32Table
- Defined in:
- lib/locale/driver/win32.rb
Constant Summary collapse
- @@win32 =
Win32API.new("kernel32.dll", "GetUserDefaultLangID", nil, "i")
Constants included from Win32Table
Locale::Driver::Win32Table::LocaleTable
Class Method Summary collapse
-
.charset ⇒ Object
Gets the Win32 charset of the locale.
-
.locales ⇒ Object
:nodoc:.
Class Method Details
.charset ⇒ Object
Gets the Win32 charset of the locale.
34 35 36 37 38 39 40 41 42 |
# File 'lib/locale/driver/win32.rb', line 34 def charset charset = ::Locale::Driver::Env.charset unless charset loc = LocaleTable.find{|v| v[1] =locale.to_general} loc = LocaleTable.find{|v| v[1] =~ /^#{locale.language}-/} unless loc charset = loc ? loc[2] : "CP1252" end charset end |
.locales ⇒ Object
:nodoc:
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/locale/driver/win32.rb', line 44 def locales #:nodoc: locales = ::Locale::Driver::Env.locales unless locales lang = LocaleTable.assoc(@@win32.call) if lang ret = Locale::Tag::Common.parse(lang[1]) else ret = Locale::Tag::Common.new("en") end locales = Locale::TagList.new([ret]) end locales end |