Skip to content

Commit

Permalink
Added workaround for proper work I18n::Backend::Simple#lookup with Ru…
Browse files Browse the repository at this point in the history
…by 1.9.x

[spree#1261 state:resolved]
  • Loading branch information
romul committed Mar 18, 2010
1 parent 9f48a22 commit d971383
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions config/initializers/workarounds_for_ruby19.rb
Expand Up @@ -99,4 +99,29 @@ def each_hash_utf8(&block)
end
end

module I18n
module Backend
class Simple
protected

def lookup(locale, key, scope = [])
return unless key
init_translations unless initialized?
keys = I18n.send(:normalize_translation_keys, locale, key, scope)
begin
keys.inject(translations) do |result, k|
if (x = result[k.to_sym]).nil?
return nil
else
x
end
end
rescue
return nil
end
end
end
end
end

end

0 comments on commit d971383

Please sign in to comment.