Commit fbb9918a by Carsten Brandt

fixed an issue with message source and model as params

parent 5b897135
...@@ -8,6 +8,7 @@ ...@@ -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 ...@@ -94,7 +95,11 @@ class I18N extends Component
*/ */
public function format($message, $params, $language) public function format($message, $params, $language)
{ {
$params = (array)$params; if ($params instanceof Arrayable) {
$params = $params->toArray();
} else {
$params = (array)$params;
}
if ($params === []) { if ($params === []) {
return $message; return $message;
} }
......
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