diff --git a/framework/yii/widgets/BaseListView.php b/framework/yii/widgets/BaseListView.php index bfa984f..27b2eaf 100644 --- a/framework/yii/widgets/BaseListView.php +++ b/framework/yii/widgets/BaseListView.php @@ -131,30 +131,32 @@ abstract class BaseListView extends Widget public function renderSummary() { $count = $this->dataProvider->getCount(); - if (($pagination = $this->dataProvider->getPagination()) !== false && $count > 0) { + if (($pagination = $this->dataProvider->getPagination()) !== false) { $totalCount = $this->dataProvider->getTotalCount(); $begin = $pagination->getPage() * $pagination->pageSize + 1; $end = $begin + $count - 1; $page = $pagination->getPage() + 1; $pageCount = $pagination->pageCount; if (($summaryContent = $this->summary) === null) { - $summaryContent = '
' . Yii::t('yii', 'Showing {begin}-{end} of {totalCount} {0, plural, =1{item} other{items}}.', $totalCount) . '
'; + $summaryContent = '
' + . Yii::t('yii', 'Showing {totalCount, plural, =0{0} other{{begin}-{end}}} of {totalCount} {totalCount, plural, one{item} other{items}}.') + . '
'; } } else { $begin = $page = $pageCount = 1; $end = $totalCount = $count; if (($summaryContent = $this->summary) === null) { - $summaryContent = '
' . Yii::t('yii', 'Total {count} {0, plural, =1{item} other{items}}.', $count) . '
'; + $summaryContent = '
' . Yii::t('yii', 'Total {count} {count, plural, one{item} other{items}}.') . '
'; } } - return strtr($summaryContent, [ - '{begin}' => $begin, - '{end}' => $end, - '{count}' => $count, - '{totalCount}' => $totalCount, - '{page}' => $page, - '{pageCount}' => $pageCount, - ]); + return Yii::$app->getI18n()->format($summaryContent, [ + 'begin' => $begin, + 'end' => $end, + 'count' => $count, + 'totalCount' => $totalCount, + 'page' => $page, + 'pageCount' => $pageCount, + ], Yii::$app->language); } /**