0
<?php
$this->widget('zii.widgets.CDetailView', array(
'data' => $model,
'htmlOptions' => array('style' => 'width:425px; float:left; margin-right:20px; word-break:break-all', 'class' => 'detail-view table table-striped table-condensed'),
'attributes' => array(
    'id',
    'name',
    'street',
    'housenumber',
    'zipcode',
    'city',
    array(
        'label' => Yii::t('api', 'Country'),
        'name' => Yii::t('api', 'country.name'),
    ),
),
));
?>

我想翻译列数组中属性标签和名称的值。但它只翻译标签而不翻译名称。

有人可以告诉我,我做错了什么吗?

4

1 回答 1

0

name是数据库中的列名,我想你要调整value一下,试试这个:

'label' => Yii::t('api', 'Country'),
'name' => 'country.name', //in reality you don't need this since you are setting the value
'value' => Yii::t('api', $model->country->name),
于 2013-07-24T15:24:23.600 回答