Module: Locale::Driver::JRuby

Defined in:
lib/locale/driver/jruby.rb

Overview

Locale::Driver::JRuby module for JRuby Detect the user locales and the charset. This is a low-level class. Application shouldn’t use this directly.

Class Method Summary collapse

Class Method Details

.charsetObject

:nodoc:



51
52
53
54
55
56
57
# File 'lib/locale/driver/jruby.rb', line 51

def charset #:nodoc:
  charset = ::Locale::Driver::Env.charset
  unless charset
    charset = java.nio.charset.Charset.defaultCharset.name
  end
  charset
end

.localesObject

:nodoc:



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/locale/driver/jruby.rb', line 35

def locales  #:nodoc:
  locales = ::Locale::Driver::Env.locales
  unless locales
    locale = java.util.Locale.getDefault
    variant = locale.getVariant 
    variants = []
    if variant != nil and variant.size > 0
      variants = [variant]
    end
    locales = TagList.new([Locale::Tag::Common.new(locale.getLanguage, nil,
                                                   locale.getCountry, 
                                                   variants)])
  end
  locales
end