Module: Padrino::Helpers::TranslationHelpers

Defined in:
padrino-helpers/lib/padrino-helpers/translation_helpers.rb

Overview

Helpers related to locale i18n translation within templates.

Instance Method Summary collapse

Instance Method Details

#localize(*args) ⇒ String Also known as: l

Delegates to I18n.localize with no additional functionality.

Parameters:

  • *args (Symbol)

    The keys to retrieve.

Returns:

  • (String)

    The translation for the specified keys.



31
32
33
# File 'padrino-helpers/lib/padrino-helpers/translation_helpers.rb', line 31

def localize(*args)
  I18n.localize(*args)
end

#translate(*args) ⇒ String Also known as: t

Delegates to I18n.translate with no additional functionality.

Parameters:

  • *args (Symbol)

    The keys to retrieve.

Returns:

  • (String)

    The translation for the specified keys.



16
17
18
19
# File 'padrino-helpers/lib/padrino-helpers/translation_helpers.rb', line 16

def translate(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  I18n.translate(*args, **options)
end