1
0
mirror of https://github.com/danbee/danbarberphoto synced 2025-03-04 08:49:07 +00:00
danbarberphoto/vendor/plugins/typus/lib/extensions/object.rb

21 lines
458 B
Ruby

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