diff --git a/composer.json b/composer.json
index 0cd5a8488..71fb52d5e 100644
--- a/composer.json
+++ b/composer.json
@@ -26,7 +26,6 @@
"php": "^8.0",
"ext-json": "*",
"ext-mbstring": "*",
- "yiisoft/aliases": "^3.0",
"yiisoft/arrays": "^2.0|^3.0",
"yiisoft/data": "dev-master",
"yiisoft/factory": "^1.0",
@@ -35,7 +34,6 @@
"yiisoft/json": "^1.0",
"yiisoft/router": "^3.0",
"yiisoft/strings": "^2.0",
- "yiisoft/translator-message-php": "^1.1",
"yiisoft/translator": "^3.0",
"yiisoft/view": "^8.0",
"yiisoft/widget": "^2.0",
@@ -53,7 +51,8 @@
"yiisoft/event-dispatcher": "^1.0",
"yiisoft/log": "^2.0",
"yiisoft/router-fastroute": "^3.0",
- "yiisoft/test-support": "^3.0"
+ "yiisoft/test-support": "^3.0",
+ "yiisoft/translator-message-php": "^1.1"
},
"extra": {
"branch-alias": {
diff --git a/config/di.php b/config/di.php
index 59241e462..9b06f2471 100644
--- a/config/di.php
+++ b/config/di.php
@@ -2,20 +2,27 @@
declare(strict_types=1);
-use Yiisoft\Aliases\Aliases;
use Yiisoft\Translator\CategorySource;
+use Yiisoft\Translator\IdMessageReader;
+use Yiisoft\Translator\IntlMessageFormatter;
use Yiisoft\Translator\Message\Php\MessageSource;
use Yiisoft\Translator\SimpleMessageFormatter;
/** @var array $params */
return [
- 'translator.dataview' => [
- 'definition' => static function (Aliases $aliases) use ($params) {
- $messageReader = new MessageSource($aliases->get('@yii-dataview/resources/messages'));
+ 'yii.dataview.categorySource' => [
+ 'definition' => static function () use ($params): CategorySource {
+ $reader = class_exists(MessageSource::class)
+ ? new MessageSource(dirname(__DIR__) . '/messages')
+ : new IdMessageReader(); // @codeCoverageIgnore
- return new CategorySource($params['yiisoft/translator']['dataviewCategory'], $messageReader, new SimpleMessageFormatter());
+ $formatter = extension_loaded('intl')
+ ? new IntlMessageFormatter()
+ : new SimpleMessageFormatter();
+
+ return new CategorySource($params['yiisoft/yii-dataview']['translation.category'], $reader, $formatter);
},
- 'tags' => ['translator.categorySource'],
+ 'tags' => ['translation.categorySource'],
],
];
diff --git a/config/params.php b/config/params.php
index 24140559e..5229d3aa4 100644
--- a/config/params.php
+++ b/config/params.php
@@ -2,13 +2,10 @@
declare(strict_types=1);
+use Yiisoft\Yii\DataView\BaseListView;
+
return [
- 'yiisoft/aliases' => [
- 'aliases' => [
- '@yii-dataview' => dirname(__DIR__),
- ],
- ],
- 'yiisoft/translator' => [
- 'dataviewCategory' => 'dataview',
+ 'yiisoft/yii-dataview' => [
+ 'translation.category' => BaseListView::DEFAULT_TRANSLATION_CATEGORY,
],
];
diff --git a/messages/es/yii-dataview.php b/messages/es/yii-dataview.php
new file mode 100644
index 000000000..db417e208
--- /dev/null
+++ b/messages/es/yii-dataview.php
@@ -0,0 +1,8 @@
+ 'No se han encontrado resultados.',
+ 'Page {currentPage} of {totalPages}' => 'Pagina {currentPage} de {totalPages}',
+];
diff --git a/messages/ru/yii-dataview.php b/messages/ru/yii-dataview.php
new file mode 100644
index 000000000..bb7e5f791
--- /dev/null
+++ b/messages/ru/yii-dataview.php
@@ -0,0 +1,8 @@
+ 'Результатов не найдено.',
+ 'Page {currentPage} of {totalPages}' => 'Страница {currentPage} из {totalPages}',
+];
diff --git a/resources/messages/en/dataview.php b/resources/messages/en/dataview.php
deleted file mode 100644
index 989deb7c4..000000000
--- a/resources/messages/en/dataview.php
+++ /dev/null
@@ -1,8 +0,0 @@
- 'No results found.',
- 'dataview.summary' => 'Page {currentPage} of {totalPages}',
-];
diff --git a/resources/messages/es/dataview.php b/resources/messages/es/dataview.php
deleted file mode 100644
index 93c1aa5fb..000000000
--- a/resources/messages/es/dataview.php
+++ /dev/null
@@ -1,8 +0,0 @@
- 'No se han encontrado resultados.',
- 'dataview.summary' => 'Pagina {currentPage} de {totalPages}',
-];
diff --git a/resources/messages/ru/dataview.php b/resources/messages/ru/dataview.php
deleted file mode 100644
index a5cae0e57..000000000
--- a/resources/messages/ru/dataview.php
+++ /dev/null
@@ -1,8 +0,0 @@
- 'результатов не найдено',
- 'dataview.summary' => 'Страница {currentPage} из {totalPages}',
-];
diff --git a/src/BaseListView.php b/src/BaseListView.php
index ec8c1670a..9c0f328cc 100644
--- a/src/BaseListView.php
+++ b/src/BaseListView.php
@@ -15,15 +15,30 @@
use Yiisoft\Html\Tag\Div;
use Yiisoft\Html\Tag\Td;
use Yiisoft\Router\UrlGeneratorInterface;
+use Yiisoft\Translator\CategorySource;
+use Yiisoft\Translator\IdMessageReader;
+use Yiisoft\Translator\IntlMessageFormatter;
use Yiisoft\Translator\SimpleMessageFormatter;
+use Yiisoft\Translator\Translator;
use Yiisoft\Translator\TranslatorInterface;
use Yiisoft\Widget\Widget;
use Yiisoft\Yii\DataView\Exception\DataReaderNotSetException;
abstract class BaseListView extends Widget
{
+ /**
+ * A name for {@see CategorySource} used with translator ({@see TranslatorInterface}) by default.
+ */
+ public const DEFAULT_TRANSLATION_CATEGORY = 'yii-dataview';
+
+ /**
+ * @var TranslatorInterface A translator instance used for translations of messages. If it was not set
+ * explicitly in the constructor, a default one created automatically in {@see createDefaultTranslator()}.
+ */
+ private TranslatorInterface $translator;
+
private array $attributes = [];
- protected string $emptyText = 'dataview.empty.text';
+ protected ?string $emptyText = null;
private array $emptyTextAttributes = [];
private string $header = '';
private array $headerAttributes = [];
@@ -31,9 +46,8 @@ abstract class BaseListView extends Widget
private string $layoutGridTable = "{items}\n{summary}\n{pager}";
private string $pagination = '';
protected ?ReadableDataInterface $dataReader = null;
- private SimpleMessageFormatter|null $simpleMessageFormatter = null;
private array $sortLinkAttributes = [];
- private string $summary = 'dataview.summary';
+ private ?string $summary = null;
private array $summaryAttributes = [];
private string $toolbar = '';
protected array $urlArguments = [];
@@ -41,9 +55,11 @@ abstract class BaseListView extends Widget
private bool $withContainer = true;
public function __construct(
- private TranslatorInterface|null $translator = null,
- private UrlGeneratorInterface|null $urlGenerator = null
+ TranslatorInterface|null $translator = null,
+ private UrlGeneratorInterface|null $urlGenerator = null,
+ private string $translationCategory = self::DEFAULT_TRANSLATION_CATEGORY,
) {
+ $this->translator = $translator ?? $this->createDefaultTranslator();
}
/**
@@ -76,7 +92,7 @@ public function attributes(array $values): static
* {@see notShowOnEmpty()}
* {@see emptyTextAttributes()}
*/
- public function emptyText(string $emptyText): static
+ public function emptyText(?string $emptyText): static
{
$new = clone $this;
$new->emptyText = $emptyText;
@@ -106,15 +122,6 @@ public function getDataReader(): ReadableDataInterface
return $this->dataReader;
}
- public function getSimpleMessageFormatter(): SimpleMessageFormatter
- {
- if ($this->simpleMessageFormatter === null) {
- $this->simpleMessageFormatter = new SimpleMessageFormatter();
- }
-
- return $this->simpleMessageFormatter;
- }
-
public function getUrlGenerator(): UrlGeneratorInterface
{
if ($this->urlGenerator === null) {
@@ -258,7 +265,7 @@ public function sortLinkAttributes(array $values): static
* - `{page}`: the page number (1-based) current being displayed.
* - `{pageCount}`: the number of pages available.
*/
- public function summary(string $value): static
+ public function summary(?string $value): static
{
$new = clone $this;
$new->summary = $value;
@@ -336,14 +343,13 @@ public function withContainer(bool $value = true): static
protected function renderEmpty(int $colspan): Td
{
$emptyTextAttributes = $this->emptyTextAttributes;
- $emptyText = $this->getSimpleMessageFormatter()->format($this->emptyText, []);
-
- if ($this->translator !== null) {
- $emptyText = $this->translator->translate($this->emptyText, [], 'dataview');
- }
-
$emptyTextAttributes['colspan'] = $colspan;
+ $emptyText = $this->translator->translate(
+ $this->emptyText ?? 'No results found.',
+ category: $this->translationCategory
+ );
+
return Td::tag()->attributes($emptyTextAttributes)->content($emptyText);
}
@@ -427,25 +433,14 @@ private function renderSummary(): string
return '';
}
- $summary = $this->getSimpleMessageFormatter()
- ->format(
- $this->summary,
- [
- 'currentPage' => $paginator->getCurrentPage(),
- 'totalPages' => $paginator->getTotalPages(),
- ]
- );
-
- if ($this->translator !== null) {
- $summary = $this->translator->translate(
- $this->summary,
- [
- 'currentPage' => $paginator->getCurrentPage(),
- 'totalPages' => $paginator->getTotalPages(),
- ],
- 'dataview',
- );
- }
+ $summary = $this->translator->translate(
+ $this->summary ?? 'Page {currentPage} of {totalPages}',
+ [
+ 'currentPage' => $paginator->getCurrentPage(),
+ 'totalPages' => $paginator->getTotalPages(),
+ ],
+ $this->translationCategory,
+ );
return Div::tag()->attributes($this->summaryAttributes)->content($summary)->encode(false)->render();
}
@@ -500,4 +495,24 @@ private function renderHeader(): string
->render(),
};
}
+
+ /**
+ * Creates default translator to use if {@see $translator} was not set explicitly in the constructor. Depending on
+ * "intl" extension availability, either {@see IntlMessageFormatter} or {@see SimpleMessageFormatter} is used as
+ * formatter.
+ *
+ * @return Translator Translator instance used for translations of messages.
+ */
+ private function createDefaultTranslator(): Translator
+ {
+ $categorySource = new CategorySource(
+ $this->translationCategory,
+ new IdMessageReader(),
+ extension_loaded('intl') ? new IntlMessageFormatter() : new SimpleMessageFormatter(),
+ );
+ $translator = new Translator();
+ $translator->addCategorySources($categorySource);
+
+ return $translator;
+ }
}
diff --git a/tests/Column/ActionColumnTest.php b/tests/Column/ActionColumnTest.php
index 2264cf407..47555fb6e 100644
--- a/tests/Column/ActionColumnTest.php
+++ b/tests/Column/ActionColumnTest.php
@@ -51,7 +51,7 @@ public function testContent(): void
-
dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -99,7 +99,7 @@ public function testContentAttributes(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -152,7 +152,7 @@ public function testCustomButton(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -211,7 +211,7 @@ public function testDataLabel(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -261,7 +261,7 @@ public function testFooterAttributes(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -309,7 +309,7 @@ public function testLabel(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -354,7 +354,7 @@ public function testLabelWithMbString(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -399,7 +399,7 @@ public function testLabelAttributes(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -444,7 +444,7 @@ public function testName(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -475,7 +475,7 @@ public function testNotVisible(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -520,7 +520,7 @@ public function testPrimaryKey(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -579,7 +579,7 @@ public function testRender(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -628,7 +628,7 @@ public function testUrlArguments(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -673,7 +673,7 @@ public function testUrlCreator(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -724,7 +724,7 @@ public function testUrlQueryParameters(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -769,7 +769,7 @@ public function testUrlParamsConfig(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -810,7 +810,7 @@ public function testVisibleButtonsClosure(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
diff --git a/tests/Column/CheckboxColumnTest.php b/tests/Column/CheckboxColumnTest.php
index f9c4276f1..fd14b8561 100644
--- a/tests/Column/CheckboxColumnTest.php
+++ b/tests/Column/CheckboxColumnTest.php
@@ -56,7 +56,7 @@ public function testContent(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -105,7 +105,7 @@ public function testContentAttributes(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -156,7 +156,7 @@ public function testDataLabel(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -203,7 +203,7 @@ public function testLabel(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -250,7 +250,7 @@ public function testLabelMbString(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -297,7 +297,7 @@ public function testLabelAttributes(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -344,7 +344,7 @@ public function testName(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -391,7 +391,7 @@ public function testNotMultiple(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -435,7 +435,7 @@ public function testNotVisible(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -482,7 +482,7 @@ public function testRender(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
diff --git a/tests/Column/DataColumnFilterTest.php b/tests/Column/DataColumnFilterTest.php
index f754ca525..1a1c6a5e9 100644
--- a/tests/Column/DataColumnFilterTest.php
+++ b/tests/Column/DataColumnFilterTest.php
@@ -96,7 +96,7 @@ public function testFilter(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -147,7 +147,7 @@ public function testFilterDate(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -199,7 +199,7 @@ public function testFilterDateTime(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -251,7 +251,7 @@ public function testFilterEmail(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -299,7 +299,7 @@ public function testFilterInputAttributes(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -359,7 +359,7 @@ public function testFilterMonth(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -407,7 +407,7 @@ public function testFilterNumber(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -459,7 +459,7 @@ public function testFilterPositionFooter(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -519,7 +519,7 @@ public function testFilterPositionHeader(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -578,7 +578,7 @@ public function testFilterRange(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -629,7 +629,7 @@ public function testFilterRowAttributes(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -688,7 +688,7 @@ public function testFilterSearch(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -739,7 +739,7 @@ public function testFilterSelect(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -797,7 +797,7 @@ public function testFilterTelephone(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -851,7 +851,7 @@ public function testFilterTime(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -905,7 +905,7 @@ public function testFilterUrl(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -959,7 +959,7 @@ public function testFilterWeek(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -1009,7 +1009,7 @@ public function testFilters(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
diff --git a/tests/Column/DataColumnTest.php b/tests/Column/DataColumnTest.php
index 311f81df2..78659254f 100644
--- a/tests/Column/DataColumnTest.php
+++ b/tests/Column/DataColumnTest.php
@@ -52,7 +52,7 @@ public function testContent(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -99,7 +99,7 @@ public function testContentAttributes(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -148,7 +148,7 @@ public function testContentAttributesClosure(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -195,7 +195,7 @@ public function testDataLabel(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -238,7 +238,7 @@ public function testLabel(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -281,7 +281,7 @@ public function testLabelMbString(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -324,7 +324,7 @@ public function testLabelAttributes(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -373,7 +373,7 @@ public function testLinkSorter(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -420,7 +420,7 @@ public function testName(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -463,7 +463,7 @@ public function testNotSorting(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -503,7 +503,7 @@ public function testNotVisible(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -546,7 +546,7 @@ public function testSort(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -589,7 +589,7 @@ public function testValue(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -632,7 +632,7 @@ public function testValueClosure(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
diff --git a/tests/Column/RadioColumnTest.php b/tests/Column/RadioColumnTest.php
index ab03fd184..777a7a7b0 100644
--- a/tests/Column/RadioColumnTest.php
+++ b/tests/Column/RadioColumnTest.php
@@ -56,7 +56,7 @@ public function testContent(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -106,7 +106,7 @@ public function testContentAttributes(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -157,7 +157,7 @@ public function testDataLabel(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -204,7 +204,7 @@ public function testLabel(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -251,7 +251,7 @@ public function testLabelMbString(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -298,7 +298,7 @@ public function testLabelAttributes(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -345,7 +345,7 @@ public function testName(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -389,7 +389,7 @@ public function testNotVisible(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -436,7 +436,7 @@ public function testRender(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
diff --git a/tests/GridView/BaseTest.php b/tests/GridView/BaseTest.php
index 83948581e..a65e39a42 100644
--- a/tests/GridView/BaseTest.php
+++ b/tests/GridView/BaseTest.php
@@ -63,7 +63,7 @@ public function testAfterItemBeforeItem(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -118,7 +118,7 @@ public function testColumnGroupEnabled(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -175,7 +175,7 @@ public function testColumnGroupEnabledEmpty(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -235,7 +235,7 @@ public function testColumnGuess(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -268,7 +268,7 @@ public function testEmptyCell(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -359,7 +359,7 @@ public function testFooterRowAttributes(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -412,7 +412,7 @@ public function testHeader(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -465,7 +465,7 @@ public function testHeaderIntoGrid(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -519,7 +519,7 @@ public function testHeaderRowAttributes(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -563,7 +563,7 @@ public function testHeaderTableEnabledFalse(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -602,7 +602,7 @@ public function testRenderEmptyData(): void
- dataview.empty.text |
+ No results found. |
@@ -656,7 +656,7 @@ public function testRowAttributes(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -699,7 +699,7 @@ public function testRowAttributes(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
@@ -751,7 +751,7 @@ public function testTableAttributes(): void
- dataview.summary
+ Page 1 of 1
HTML,
GridView::widget()
diff --git a/tests/GridView/TranslatorTest.php b/tests/GridView/TranslatorTest.php
index 98314bceb..a0dd132a6 100644
--- a/tests/GridView/TranslatorTest.php
+++ b/tests/GridView/TranslatorTest.php
@@ -5,7 +5,6 @@
namespace Yiisoft\Yii\DataView\Tests\GridView;
use PHPUnit\Framework\TestCase;
-use Yiisoft\Aliases\Aliases;
use Yiisoft\Definitions\Exception\CircularReferenceException;
use Yiisoft\Definitions\Exception\InvalidConfigException;
use Yiisoft\Definitions\Exception\NotInstantiableException;
@@ -13,8 +12,6 @@
use Yiisoft\Di\Container;
use Yiisoft\Di\ContainerConfig;
use Yiisoft\Di\NotFoundException;
-use Yiisoft\Translator\MessageFormatterInterface;
-use Yiisoft\Translator\SimpleMessageFormatter;
use Yiisoft\Translator\Translator;
use Yiisoft\Translator\TranslatorInterface;
use Yiisoft\Widget\WidgetFactory;
@@ -158,7 +155,7 @@ public function testEmptyTextTranslatorWithLocaleRussian(): void
- результатов не найдено |
+ Результатов не найдено. |
@@ -343,18 +340,11 @@ private function config(): array
return array_merge(
[
- Aliases::class => [
- 'class' => Aliases::class,
- '__construct()' => [$params['yiisoft/aliases']['aliases']],
- ],
-
- MessageFormatterInterface::class => SimpleMessageFormatter::class,
-
TranslatorInterface::class => [
'class' => Translator::class,
'__construct()' => ['en'],
'addCategorySources()' => [
- 'categories' => Reference::to('tag@translator.categorySource'),
+ 'categories' => Reference::to('tag@translation.categorySource'),
],
],
],
diff --git a/tests/ListView/BaseTest.php b/tests/ListView/BaseTest.php
index 9e3230d86..cbfc9a8ca 100644
--- a/tests/ListView/BaseTest.php
+++ b/tests/ListView/BaseTest.php
@@ -44,7 +44,7 @@ public function testAfterItemBeforeItem(): void
Id: 2
Name: Mary
Age: 21
- dataview.summary
+ Page 1 of 1
HTML,
ListView::widget()
@@ -74,7 +74,7 @@ public function testItemViewAttributes(): void
- dataview.summary
+ Page 1 of 1
HTML,
ListView::widget()
@@ -103,7 +103,7 @@ public function testItemViewAsString(): void
- dataview.summary
+ Page 1 of 1
HTML,
ListView::widget()
@@ -131,7 +131,7 @@ public function testItemViewAsCallable(): void
- dataview.summary
+ Page 1 of 1
HTML,
ListView::widget()
@@ -161,7 +161,7 @@ public function testSeparator(): void
- dataview.summary
+ Page 1 of 1
HTML,
ListView::widget()
@@ -190,7 +190,7 @@ public function testViewParams(): void
- dataview.summary
+ Page 1 of 1
HTML,
ListView::widget()
diff --git a/tests/Pagination/KeysetPaginationBaseTest.php b/tests/Pagination/KeysetPaginationBaseTest.php
index b6734d552..4c5b0114a 100644
--- a/tests/Pagination/KeysetPaginationBaseTest.php
+++ b/tests/Pagination/KeysetPaginationBaseTest.php
@@ -53,7 +53,7 @@ public function testRenderPaginatorEmptyData(): void
- dataview.empty.text |
+ No results found. |
diff --git a/tests/Pagination/OffsetPaginationBaseTest.php b/tests/Pagination/OffsetPaginationBaseTest.php
index 68ef5e445..b61f94f5b 100644
--- a/tests/Pagination/OffsetPaginationBaseTest.php
+++ b/tests/Pagination/OffsetPaginationBaseTest.php
@@ -37,7 +37,7 @@ public function testRenderPaginatorEmptyData(): void
- dataview.empty.text |
+ No results found. |