instance method
lookup
Ruby on Rails 2.3.18
Since v2.3.18 Last seen in v2.3.18Signature
lookup(locale, key, scope = [], options = {})
No documentation comment.
Parameters
-
localereq -
keyreq -
scopeopt = [] -
optionsopt = {}
Source
# File activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/cascade.rb, line 38
def lookup(locale, key, scope = [], options = {})
return super unless cascade = options[:cascade]
separator = options[:separator] || I18n.default_separator
skip_root = cascade.has_key?(:skip_root) ? cascade[:skip_root] : true
step = cascade[:step]
keys = I18n.normalize_keys(nil, key, nil, separator)
offset = options[:cascade][:offset] || keys.length
scope = I18n.normalize_keys(nil, nil, scope, separator) + keys
key = scope.slice!(-offset, offset).join(separator)
begin
result = super
return result unless result.nil?
end while !scope.empty? && scope.slice!(-step, step) && (!scope.empty? || !skip_root)
end
Defined in activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/cascade.rb line 38
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in I18n::Backend::Cascade