Sha256: f028bf28530e409af36cbe2f53ff0d8a29d44097c8bf6a44b7f7fb150d4d0d00

Contents?: true

Size: 462 Bytes

Versions: 3

Compression:

Stored size: 462 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:
  #
  #     _t("Hello World!")
  #
  # Note that interpolation still works ...
  #
  #     _t("Hello %{world}!", :world => @world)
  #
  def _t(msg, *args)
    options = args.extract_options!
    options[:default] = msg
    I18n.t(msg, options)
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
typus-1.0.0.pre8 lib/support/object.rb
typus-1.0.0.pre7 lib/support/object.rb
typus-1.0.0.pre6 lib/support/object.rb