yii2: yii\i18n format() does not work on certain messages

To mention core Yii2, yii\widgets\BaseListView in line 163 contains:

$summaryContent = '<div class="summary">'
                    . Yii::t('yii', 'Showing <b>{begin}-{end, number}</b> of <b>{totalCount, number}</b> {totalCount, plural, one{item} other{items}}.')
                    . '</div>';

And in line 174:

return Yii::$app->getI18n()->format($summaryContent, [
            'begin' => $begin,
            'end' => $end,
            'count' => $count,
            'totalCount' => $totalCount,
            'page' => $page,
            'pageCount' => $pageCount,
        ], Yii::$app->language);

cannot process this string.

If I change line 163 to:

$summaryContent = '<div class="summary">'
                    . Yii::t('yii', 'Showing <b>{begin, number}-{end, number}</b> of <b>{totalCount, number}</b>.')
                    . '</div>';

then it replaces the labels.

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 23 (12 by maintainers)

Commits related to this issue

Most upvoted comments

can you please post the ouput of the following PHP code:

echo PHP_VERSION . "\n";
echo INTL_ICU_VERSION . "\n";