lib/loaf/translation.rb in loaf-0.4.0 vs lib/loaf/translation.rb in loaf-0.5.0
- old
+ new
@@ -3,12 +3,12 @@
module Loaf
module Translation
extend self
# Returns translation lookup
- def i18n_scope
- :breadcrumbs
+ def translation_scope
+ "loaf.breadcrumbs"
end
# Translate breadcrumb title
#
# @param [String] :title
@@ -17,15 +17,13 @@
# The translation scope
# @option options [String] :default
# The default translation
#
# @api public
- def breadcrumb_title(title, options = {})
- defaults = []
- defaults << :"#{i18n_scope}.#{title}"
- defaults << options.delete(:default) if options[:default]
-
- options.reverse_merge! count: 1, default: defaults
- I18n.t(title, options)
+ 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