Sha256: 4557f828445d5328e43d0d6a3385abdc24eacb4c022532a6f914729413f4f9f4

Contents?: true

Size: 464 Bytes

Versions: 7

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

7 entries across 7 versions & 1 rubygems

Version Path
fesplugas-typus-0.9.10 lib/typus/object.rb
fesplugas-typus-0.9.11 lib/typus/object.rb
fesplugas-typus-0.9.12 lib/typus/object.rb
fesplugas-typus-0.9.13 lib/typus/object.rb
fesplugas-typus-0.9.14 lib/typus/object.rb
fesplugas-typus-0.9.15 lib/typus/object.rb
fesplugas-typus-0.9.9 lib/typus/object.rb