diff --git a/lib/i18n/translate.rb b/lib/i18n/translate.rb index c189197..a373cc6 100644 --- a/lib/i18n/translate.rb +++ b/lib/i18n/translate.rb @@ -90,7 +90,7 @@ def self.find(key, hash, separator=".") path = key.to_s.split(separator) path.each do |key| h = h[key] - return nil unless h + return nil if h.nil? end h end @@ -247,7 +247,7 @@ def self.valid_file?(fname, format=Translate::DEFAULT_OPTIONS[:format]) # } def [](key) d = I18n::Translate.find(key, @default, @options[:separator]) - raise "Translate#[key]: wrong key '#{key}'" unless d + raise "Translate#[key]: wrong key '#{key}'" if d.nil? entry = {"key" => key, "default" => d} if d.kind_of? Hash