Commit 33f6e814 by Carsten Brandt

make Yii::t fallback behavior consistent with I18N::translate

parent 2a4a5256
...@@ -515,7 +515,11 @@ class BaseYii ...@@ -515,7 +515,11 @@ class BaseYii
if (self::$app !== null) { if (self::$app !== null) {
return self::$app->getI18n()->translate($category, $message, $params, $language ?: self::$app->language); return self::$app->getI18n()->translate($category, $message, $params, $language ?: self::$app->language);
} else { } else {
return is_array($params) ? strtr($message, $params) : $message; $p = [];
foreach((array) $params as $name => $value) {
$p['{' . $name . '}'] = $value;
}
return ($p === []) ? $message : strtr($message, $p);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment