lib/loaf/translation.rb in loaf-0.3.0 vs lib/loaf/translation.rb in loaf-0.4.0
- old
+ new
@@ -1,24 +1,31 @@
+# encoding: utf-8
+
module Loaf
module Translation
extend self
# Returns translation lookup
def i18n_scope
:breadcrumbs
end
- # Accepts <tt>:scope</tt> parameter.
- def breadcrumb_title(title, options={})
+ # 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 breadcrumb_title(title, options = {})
defaults = []
- parts = title.to_s.split('.', 2)
- actions = parts.pop
- namespace = parts.pop
-
- defaults << :"#{self.i18n_scope}.#{title}"
+ defaults << :"#{i18n_scope}.#{title}"
defaults << options.delete(:default) if options[:default]
- options.reverse_merge! :count => 1, :default => defaults
+ options.reverse_merge! count: 1, default: defaults
I18n.t(title, options)
end
end # Translation
end # Loaf