Module: Lita::Handler::Common::ClassMethods

Defined in:
lib/lita/handler/common.rb

Overview

Common class-level methods for all handlers.

Since:

  • 4.0.0

Instance Method Summary collapse

Instance Method Details

#translate(key, hash = {}) ⇒ String Also known as: t

Returns the translation for a key, automatically namespaced to the handler.

Parameters:

  • key (String)

    The key of the translation.

  • hash (Hash) (defaults to: {})

    An optional hash of values to be interpolated in the string.

Returns:

  • (String)

    The translated string.

Since:

  • 3.0.0



21
22
23
# File 'lib/lita/handler/common.rb', line 21

def translate(key, hash = {})
  I18n.translate("lita.handlers.#{namespace}.#{key}", hash)
end