From f2fce2f45695c4548cac157af13218a3900c128c Mon Sep 17 00:00:00 2001 From: mesour Date: Tue, 8 Mar 2016 13:35:27 +0100 Subject: [PATCH] Added translate for empty data messages --- docs/localisation.md | 16 +++++++++------- src/Mesour/DataGrid/BaseGrid.php | 4 ++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/docs/localisation.md b/docs/localisation.md index 52339bc..80538ed 100644 --- a/docs/localisation.md +++ b/docs/localisation.md @@ -6,10 +6,12 @@ This component also uses this next translation keys: - [mesour/pager](https://github.com/mesour/pager/blob/master/docs/localisation.md) - [mesour/selection](https://github.com/mesour/selection/blob/master/docs/localisation.md) -| Key | Description | -|--------------------|------------------------------------------------------------------------| -| Export | Used as text in main button for export dropdown | -| Export filtered | Used in export dropdown | -| Export all | Used in export dropdown | -| Selected | Used as text in main button for selection dropdown | -| Export to CSV | Used in selection dropdown | +| Key | Description | +|---------------------------------------------------|---------------------------------------------------------| +| Export | Used as text in main button for export dropdown | +| Export filtered | Used in export dropdown | +| Export all | Used in export dropdown | +| Selected | Used as text in main button for selection dropdown | +| Export to CSV | Used in selection dropdown | +| Nothing to display. | Used if has no data | +| Nothing found. Please change the filter criteria. | Used if has no data after filtering | diff --git a/src/Mesour/DataGrid/BaseGrid.php b/src/Mesour/DataGrid/BaseGrid.php index c6e1066..c5ca00d 100644 --- a/src/Mesour/DataGrid/BaseGrid.php +++ b/src/Mesour/DataGrid/BaseGrid.php @@ -385,9 +385,9 @@ private function createTable($data, $rawData) $body = $renderer->createBody(); if ($this->getSource()->getTotalCount() === 0) { - $this->addRow($body, count($columns), [], true, $this->emptyText); + $this->addRow($body, count($columns), [], true, $this->getTranslator()->translate($this->emptyText)); } else if ($this->count === 0) { - $this->addRow($body, count($columns), [], true, $this->emptyFilterText); + $this->addRow($body, count($columns), [], true, $this->getTranslator()->translate($this->emptyFilterText)); } else { foreach ($data as $key => $rowData) { $this->addRow($body, $rowData, $rawData[$key]);