Commit 6559b06e by Carsten Brandt

made intl messages more compatible with various ICU versions

issue #1072
parent 66fd16e8
......@@ -92,7 +92,7 @@ class MessageFormatter extends Component
return $this->fallbackFormat($pattern, $params, $language);
}
if (version_compare(PHP_VERSION, '5.5.0', '<')) {
if (version_compare(PHP_VERSION, '5.5.0', '<') || version_compare(INTL_ICU_VERSION, '4.8', '<')) {
$pattern = $this->replaceNamedArguments($pattern, $params);
$params = array_values($params);
}
......
......@@ -135,18 +135,21 @@ abstract class BaseListView extends Widget
$totalCount = $this->dataProvider->getTotalCount();
$begin = $pagination->getPage() * $pagination->pageSize + 1;
$end = $begin + $count - 1;
if ($begin > $end) {
$begin = $end;
}
$page = $pagination->getPage() + 1;
$pageCount = $pagination->pageCount;
if (($summaryContent = $this->summary) === null) {
$summaryContent = '<div class="summary">'
. Yii::t('yii', 'Showing <b>{totalCount, plural, zero{0} other{{begin, number, integer}-{end, number, integer}}}</b> of <b>{totalCount, number, integer}</b> {totalCount, plural, one{item} other{items}}.')
. Yii::t('yii', 'Showing <b>{begin, number}-{end, number}</b> of <b>{totalCount, number}</b> {totalCount, plural, one{item} other{items}}.')
. '</div>';
}
} else {
$begin = $page = $pageCount = 1;
$end = $totalCount = $count;
if (($summaryContent = $this->summary) === null) {
$summaryContent = '<div class="summary">' . Yii::t('yii', 'Total <b>{count, number, integer}</b> {count, plural, one{item} other{items}}.') . '</div>';
$summaryContent = '<div class="summary">' . Yii::t('yii', 'Total <b>{count, number}</b> {count, plural, one{item} other{items}}.') . '</div>';
}
}
return Yii::$app->getI18n()->format($summaryContent, [
......
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