Class: Slices::I18nBackend

Inherits:
Object
  • Object
show all
Includes:
I18n::Backend::Simple::Implementation
Defined in:
lib/slices/i18n_backend.rb

Instance Method Summary collapse

Instance Method Details

#translate(locale, key, options = {}) ⇒ Object

Translates the given local and key. See the I18n API documentation for details.

Returns:

  • (Object)

    the translated key (usually a String)



10
11
12
13
14
15
16
17
# File 'lib/slices/i18n_backend.rb', line 10

def translate(locale, key, options = {})
  content = super(locale, key, options.merge(fallback: true))
  if content.respond_to?(:html_safe)
    content.html_safe
  else
    content
  end
end