Sha256: 7c0e1dda1e0002540ac873a6d8a9987d0c3a263f0be2855aa1bac12ef4fe94b8

Contents?: true

Size: 620 Bytes

Versions: 7

Compression:

Stored size: 620 Bytes

Contents

require 'active_support/core_ext/object/blank'

class java::util::Locale
  def self.current_locale
    self.getDefault
  end

  def self.current_locale=(l)
    self.setDefault(l.to_locale)
  end
  
  def to_locale
    self
  end
  
  def human_name
    l = Locale.current_locale
    display_country = country.blank? ? "" : " (#{getDisplayCountry(l)})"
    display_variant = variant.blank? ? "" : " - #{getDisplayVariant(l)}"
    "#{getDisplayLanguage(l)}#{display_country}#{display_variant}"
  end
  
  def inspect
    "Locale[#{human_name}]"
  end

  def to_str
    to_s
  end
  
  def to_sym
    to_s.to_sym
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
jactive_support-2.1.2 lib/jactive_support/java_ext/locale.rb
jactive_support-3.0.0 lib/jactive_support/java_ext/locale.rb
jactive_support-3.0.0.pre2 lib/jactive_support/java_ext/locale.rb
jactive_support-3.0.0.pre1 lib/jactive_support/java_ext/locale.rb
jactive_support-2.1.1 lib/jactive_support/java_ext/locale.rb
jactive_support-2.1.0 lib/jactive_support/java_ext/locale.rb
jactive_support-2.0.0 lib/jactive_support/java_ext/locale.rb