Permalink
Browse files

add default options to Cascade#lookup

  • Loading branch information...
1 parent 941ad9b commit 0b9a1f2058a2be9543106cc19d08071c359511e1 Sven Fuchs committed Nov 1, 2010
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/i18n/backend/cascade.rb
@@ -38,9 +38,10 @@ module Cascade
def lookup(locale, key, scope = [], options = {})
return super unless cascade = options[:cascade]
+ cascade = { :step => 1 } unless cascade.is_a?(Hash)
separator = options[:separator] || I18n.default_separator
skip_root = cascade.has_key?(:skip_root) ? cascade[:skip_root] : true
- step = cascade[:step]
+ step = cascade[:step] || 1
keys = I18n.normalize_keys(nil, key, nil, separator)
offset = options[:cascade][:offset] || keys.length

0 comments on commit 0b9a1f2

Please sign in to comment.