Browse Source

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

tags/2.0.0-beta
Carsten Brandt 11 years ago
parent
commit
33f6e81463
  1. 6
      framework/yii/BaseYii.php

6
framework/yii/BaseYii.php

@ -515,7 +515,11 @@ class BaseYii
if (self::$app !== null) {
return self::$app->getI18n()->translate($category, $message, $params, $language ?: self::$app->language);
} 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);
}
}

Loading…
Cancel
Save