Sha256: 0ec0b3111339401a39dfc71ceea7dabcc06d6575a0ddc9b93a44f7fb239bb316

Contents?: true

Size: 581 Bytes

Versions: 3

Compression:

Stored size: 581 Bytes

Contents

module Loaf
  module Translation
    extend self

    # Returns translation lookup
    def i18n_scope
      :breadcrumbs
    end

    # Accepts <tt>:scope</tt> parameter.
    def breadcrumb_title(title, options={})
      defaults  = []
      parts     = title.to_s.split('.', 2)
      actions   = parts.pop
      namespace = parts.pop

      defaults << :"#{self.i18n_scope}.#{title}"
      defaults << options.delete(:default) if options[:default]

      options.reverse_merge! :count => 1, :default => defaults
      I18n.t(title, options)
    end
  end # Translation
end # Loaf

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
loaf-0.3.0 lib/loaf/translation.rb
loaf-0.2.1 lib/loaf/translation.rb
loaf-0.2.0 lib/loaf/translation.rb