mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-23 04:00:23 +08:00
fixed an issue with message source and model as params
This commit is contained in:
@ -8,6 +8,7 @@
|
||||
namespace yii\i18n;
|
||||
|
||||
use Yii;
|
||||
use yii\base\Arrayable;
|
||||
use yii\base\Component;
|
||||
use yii\base\InvalidConfigException;
|
||||
|
||||
@ -94,7 +95,11 @@ class I18N extends Component
|
||||
*/
|
||||
public function format($message, $params, $language)
|
||||
{
|
||||
$params = (array)$params;
|
||||
if ($params instanceof Arrayable) {
|
||||
$params = $params->toArray();
|
||||
} else {
|
||||
$params = (array)$params;
|
||||
}
|
||||
if ($params === []) {
|
||||
return $message;
|
||||
}
|
||||
|
Reference in New Issue
Block a user