未验证 提交 7bcb04c7 编写于 作者: G Guillermo Iguaran 提交者: GitHub

Merge pull request #32326 from q-centrix/perf-improvement-translation-helper-default-array

Only create an array with default options if we have default options
......@@ -60,7 +60,11 @@ module TranslationHelper
def translate(key, options = {})
options = options.dup
has_default = options.has_key?(:default)
remaining_defaults = Array(options.delete(:default)).compact
if has_default
remaining_defaults = Array(options.delete(:default)).compact
else
remaining_defaults = []
end
if has_default && !remaining_defaults.first.kind_of?(Symbol)
options[:default] = remaining_defaults
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册