Module: Loaf::Translation

Extended by:
Translation
Included in:
Translation
Defined in:
lib/loaf/translation.rb

Instance Method Summary collapse

Instance Method Details

#find_title(title, options = {}) ⇒ Object

Translate breadcrumb title

Options Hash (options):

  • :scope (String)

    The translation scope

  • :default (String)

    The default translation



22
23
24
25
26
27
# File 'lib/loaf/translation.rb', line 22

def find_title(title, options = {})
  options[:scope] ||= translation_scope
  options[:default] = Array(options[:default])
  options[:default] << title if options[:default].empty?
  I18n.t("#{title}", options)
end

#translation_scopeObject

Returns translation lookup



8
9
10
# File 'lib/loaf/translation.rb', line 8

def translation_scope
  "loaf.breadcrumbs"
end