提交 8c2e839e 编写于 作者: J Joshua Peek

Fix some warnings in i18n lib

上级 d84d99a8
......@@ -53,7 +53,7 @@ def exception_handler=(exception_handler)
# storage. Decoupled for backends like a db backend that persist their
# translations, so the backend can decide whether/when to yield or not.
def populate(&block)
backend.populate &block
backend.populate(&block)
end
# Stores translations for the given locale in the backend.
......@@ -173,8 +173,8 @@ def default_exception_handler(exception, locale, key, options)
# keys are Symbols.
def normalize_translation_keys(locale, key, scope)
keys = [locale] + Array(scope) + [key]
keys = keys.map{|key| key.to_s.split(/\./) }
keys.flatten.map{|key| key.to_sym}
keys = keys.map{|k| k.to_s.split(/\./) }
keys.flatten.map{|k| k.to_sym}
end
end
end
......
......@@ -23,7 +23,7 @@ def store_translations(locale, data)
def translate(locale, key, options = {})
raise InvalidLocale.new(locale) if locale.nil?
return key.map{|key| translate locale, key, options } if key.is_a? Array
return key.map{|k| translate locale, k, options } if key.is_a? Array
reserved = :scope, :default
count, scope, default = options.values_at(:count, *reserved)
......@@ -66,7 +66,7 @@ def localize(locale, object, format = :default)
def lookup(locale, key, scope = [])
return unless key
keys = I18n.send :normalize_translation_keys, locale, key, scope
keys.inject(@@translations){|result, key| result[key.to_sym] or return nil }
keys.inject(@@translations){|result, k| result[k.to_sym] or return nil }
end
# Evaluates a default translation.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册