Sha256: f5ee57a2fff758559fa567f4ce6fcb4b1c2a4f108344b9deaf78837ffa36675f

Contents?: true

Size: 659 Bytes

Versions: 2

Compression:

Stored size: 659 Bytes

Contents

class Object
  def to_l string, binding = nil
    lang = RubyExt::Localization.language
    unless lang == RubyExt::Localization::DEFAULT_LANGUAGE
      aself = self.respond_to(:localization_self) || self
      aclass = (aself.class == Class or aself.class == Module) ? aself : aself.class            
      
      localization = aclass.localization lang
      if localization and localization.include? string
        string = localization[string]
      else        
        RubyExt::Localization.log.warn("Not localized: '#{aclass.name}' '#{string}'!")
      end    
    end
    
    string = string.interpolate binding if binding
    return string
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-ext-0.4.1 old/lib/RubyExt/Localization/Object.rb
ruby-ext-0.4.0 old/lib/RubyExt/Localization/Object.rb