Sha256: e88f67e5419b1314c5317d7efcd1b98b4eed38aeb4f4e9cb6ded8c424554094e

Contents?: true

Size: 464 Bytes

Versions: 9

Compression:

Stored size: 464 Bytes

Contents

class Object

  ##
  # Instead of having to translate strings and defining a default value:
  #
  #     t('Hello World!', :default => 'Hello World!')
  #
  # We define this method to define the value only once:
  #
  #     _('Hello World!')
  #
  # Note that interpolation still works ...
  #
  #     _('Hello {{world}}!', :world => @world)
  #
  def _(msg, *args)
    options = args.extract_options!
    options[:default] = msg
    I18n.t(msg, options)
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
fesplugas-typus-0.9.0 lib/typus/object.rb
fesplugas-typus-0.9.1 lib/typus/object.rb
fesplugas-typus-0.9.2 lib/typus/object.rb
fesplugas-typus-0.9.3 lib/typus/object.rb
fesplugas-typus-0.9.4 lib/typus/object.rb
fesplugas-typus-0.9.5 lib/typus/object.rb
fesplugas-typus-0.9.6 lib/typus/object.rb
fesplugas-typus-0.9.7 lib/typus/object.rb
fesplugas-typus-0.9.8 lib/typus/object.rb