Sha256: f2faebf63ffd0958bb57604478341b0966ea36fc9ab0cac5ba35c986a52189c9

Contents?: true

Size: 459 Bytes

Versions: 5

Compression:

Stored size: 459 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

5 entries across 5 versions & 1 rubygems

Version Path
typus-1.0.0.pre5 lib/support/object.rb
typus-1.0.0.pre4 lib/support/object.rb
typus-1.0.0.pre3 lib/support/object.rb
typus-1.0.0.pre2 lib/support/object.rb
typus-1.0.0.pre lib/support/object.rb