Browse Source

fixed an issue with message source and model as params

tags/2.0.0-beta
Carsten Brandt 11 years ago
parent
commit
fbb9918a46
  1. 5
      framework/yii/i18n/I18N.php

5
framework/yii/i18n/I18N.php

@ -8,6 +8,7 @@
namespace yii\i18n; namespace yii\i18n;
use Yii; use Yii;
use yii\base\Arrayable;
use yii\base\Component; use yii\base\Component;
use yii\base\InvalidConfigException; use yii\base\InvalidConfigException;
@ -94,7 +95,11 @@ class I18N extends Component
*/ */
public function format($message, $params, $language) public function format($message, $params, $language)
{ {
if ($params instanceof Arrayable) {
$params = $params->toArray();
} else {
$params = (array)$params; $params = (array)$params;
}
if ($params === []) { if ($params === []) {
return $message; return $message;
} }

Loading…
Cancel
Save