Sha256: edbd731f6f1ac1fd2270ee2967bc612b834314a5ccda5c4cc6a668c3ed543a66

Contents?: true

Size: 703 Bytes

Versions: 4

Compression:

Stored size: 703 Bytes

Contents

# frozen_string_literal: true

module Loaf
  module Translation
    extend self

    # Returns translation lookup
    def translation_scope
      "loaf.breadcrumbs"
    end

    # Translate breadcrumb title
    #
    # @param [String] :title
    # @param [Hash] options
    # @option options [String] :scope
    #   The translation scope
    # @option options [String] :default
    #   The default translation
    #
    # @api public
    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
  end # Translation
end # Loaf

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
loaf-0.7.0 lib/loaf/translation.rb
loaf-0.6.2 lib/loaf/translation.rb
loaf-0.6.1 lib/loaf/translation.rb
loaf-0.6.0 lib/loaf/translation.rb