From bfdcfa8cc39bba82aebd1fe5d04a1ffecbbf03a2 Mon Sep 17 00:00:00 2001 From: michiboo Date: Thu, 28 Sep 2023 11:51:37 +0200 Subject: [PATCH] I18n: Mark up explore/table for translations (#74368) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * added Internationalization to table container * reduce level for label of explore table * lint * restore translations * refactor getTableTitle logic to not require duplicate t phrases * Update public/app/features/explore/Table/TableContainer.tsx Co-authored-by: Piotr Jamróz --------- Co-authored-by: Deepali Gupta <90255953+Deepali1211@users.noreply.github.com> Co-authored-by: joshhunt Co-authored-by: Josh Hunt Co-authored-by: Piotr Jamróz --- .../app/features/explore/Table/TableContainer.tsx | 14 ++++++++------ public/locales/de-DE/grafana.json | 5 +++++ public/locales/en-US/grafana.json | 5 +++++ public/locales/es-ES/grafana.json | 5 +++++ public/locales/fr-FR/grafana.json | 5 +++++ public/locales/pseudo-LOCALE/grafana.json | 5 +++++ public/locales/zh-Hans/grafana.json | 5 +++++ 7 files changed, 38 insertions(+), 6 deletions(-) diff --git a/public/app/features/explore/Table/TableContainer.tsx b/public/app/features/explore/Table/TableContainer.tsx index 8bbaa02ec7e..57e9e6a27f7 100644 --- a/public/app/features/explore/Table/TableContainer.tsx +++ b/public/app/features/explore/Table/TableContainer.tsx @@ -5,6 +5,7 @@ import { applyFieldOverrides, TimeZone, SplitOpen, DataFrame, LoadingState, Fiel import { getTemplateSrv } from '@grafana/runtime'; import { Table, AdHocFilterItem, PanelChrome } from '@grafana/ui'; import { config } from 'app/core/config'; +import { t } from 'app/core/internationalization'; import { hasDeprecatedParentRowIndex, migrateFromParentRowIndexToNestedFrames, @@ -51,11 +52,12 @@ export class TableContainer extends PureComponent { } getTableTitle(dataFrames: DataFrame[] | null, data: DataFrame, i: number) { - let title = data.name ? `Table - ${data.name}` : 'Table'; - if (dataFrames && dataFrames.length > 1) { - title = `Table - ${data.name || data.refId || i}`; + let name = data.name; + if (!name && (dataFrames?.length ?? 0) > 1) { + name = data.refId || `${i}`; } - return title; + + return name ? t('explore.table.title-with-name', 'Table - {{name}}', { name }) : t('explore.table.title', 'Table'); } render() { @@ -87,8 +89,8 @@ export class TableContainer extends PureComponent { return ( <> {frames && frames.length === 0 && ( - - {() => } + + {() => } )} {frames && diff --git a/public/locales/de-DE/grafana.json b/public/locales/de-DE/grafana.json index 63c2e952fde..2f59edbd491 100644 --- a/public/locales/de-DE/grafana.json +++ b/public/locales/de-DE/grafana.json @@ -225,6 +225,11 @@ }, "explore": { "add-to-dashboard": "", + "table": { + "no-data": "", + "title": "", + "title-with-name": "" + }, "toolbar": { "aria-label": "", "copy-shortened-link": "", diff --git a/public/locales/en-US/grafana.json b/public/locales/en-US/grafana.json index fd96032ef5e..68644452f33 100644 --- a/public/locales/en-US/grafana.json +++ b/public/locales/en-US/grafana.json @@ -225,6 +225,11 @@ }, "explore": { "add-to-dashboard": "Add to dashboard", + "table": { + "no-data": "0 series returned", + "title": "Table", + "title-with-name": "Table - {{name}}" + }, "toolbar": { "aria-label": "Explore toolbar", "copy-shortened-link": "Copy shortened link", diff --git a/public/locales/es-ES/grafana.json b/public/locales/es-ES/grafana.json index 3535a6124c8..eca26972eb0 100644 --- a/public/locales/es-ES/grafana.json +++ b/public/locales/es-ES/grafana.json @@ -230,6 +230,11 @@ }, "explore": { "add-to-dashboard": "", + "table": { + "no-data": "", + "title": "", + "title-with-name": "" + }, "toolbar": { "aria-label": "", "copy-shortened-link": "", diff --git a/public/locales/fr-FR/grafana.json b/public/locales/fr-FR/grafana.json index 4634fe3681a..ad5d72d500d 100644 --- a/public/locales/fr-FR/grafana.json +++ b/public/locales/fr-FR/grafana.json @@ -230,6 +230,11 @@ }, "explore": { "add-to-dashboard": "", + "table": { + "no-data": "", + "title": "", + "title-with-name": "" + }, "toolbar": { "aria-label": "", "copy-shortened-link": "", diff --git a/public/locales/pseudo-LOCALE/grafana.json b/public/locales/pseudo-LOCALE/grafana.json index e453f94e5d8..a10087724df 100644 --- a/public/locales/pseudo-LOCALE/grafana.json +++ b/public/locales/pseudo-LOCALE/grafana.json @@ -225,6 +225,11 @@ }, "explore": { "add-to-dashboard": "Åđđ ŧő đäşĥþőäřđ", + "table": { + "no-data": "0 şęřįęş řęŧūřʼnęđ", + "title": "Ŧäþľę", + "title-with-name": "Ŧäþľę - {{name}}" + }, "toolbar": { "aria-label": "Ēχpľőřę ŧőőľþäř", "copy-shortened-link": "Cőpy şĥőřŧęʼnęđ ľįʼnĸ", diff --git a/public/locales/zh-Hans/grafana.json b/public/locales/zh-Hans/grafana.json index 63075f2923f..34117d1e055 100644 --- a/public/locales/zh-Hans/grafana.json +++ b/public/locales/zh-Hans/grafana.json @@ -220,6 +220,11 @@ }, "explore": { "add-to-dashboard": "", + "table": { + "no-data": "", + "title": "", + "title-with-name": "" + }, "toolbar": { "aria-label": "", "copy-shortened-link": "",