I18n: Mark up explore/table for translations (#74368)

* 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 <pm.jamroz@gmail.com>

---------

Co-authored-by: Deepali Gupta <90255953+Deepali1211@users.noreply.github.com>
Co-authored-by: joshhunt <josh@trtr.co>
Co-authored-by: Josh Hunt <joshhunt@users.noreply.github.com>
Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com>
pull/75623/head
michiboo 2 years ago committed by GitHub
parent f9edaa5d78
commit bfdcfa8cc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      public/app/features/explore/Table/TableContainer.tsx
  2. 5
      public/locales/de-DE/grafana.json
  3. 5
      public/locales/en-US/grafana.json
  4. 5
      public/locales/es-ES/grafana.json
  5. 5
      public/locales/fr-FR/grafana.json
  6. 5
      public/locales/pseudo-LOCALE/grafana.json
  7. 5
      public/locales/zh-Hans/grafana.json

@ -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<Props> {
}
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<Props> {
return (
<>
{frames && frames.length === 0 && (
<PanelChrome title={'Table'} width={width} height={200}>
{() => <MetaInfoText metaItems={[{ value: '0 series returned' }]} />}
<PanelChrome title={t('explore.table.title', 'Table')} width={width} height={200}>
{() => <MetaInfoText metaItems={[{ value: t('explore.table.no-data', '0 series returned') }]} />}
</PanelChrome>
)}
{frames &&

@ -225,6 +225,11 @@
},
"explore": {
"add-to-dashboard": "",
"table": {
"no-data": "",
"title": "",
"title-with-name": ""
},
"toolbar": {
"aria-label": "",
"copy-shortened-link": "",

@ -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",

@ -230,6 +230,11 @@
},
"explore": {
"add-to-dashboard": "",
"table": {
"no-data": "",
"title": "",
"title-with-name": ""
},
"toolbar": {
"aria-label": "",
"copy-shortened-link": "",

@ -230,6 +230,11 @@
},
"explore": {
"add-to-dashboard": "",
"table": {
"no-data": "",
"title": "",
"title-with-name": ""
},
"toolbar": {
"aria-label": "",
"copy-shortened-link": "",

@ -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ĸ",

@ -220,6 +220,11 @@
},
"explore": {
"add-to-dashboard": "",
"table": {
"no-data": "",
"title": "",
"title-with-name": ""
},
"toolbar": {
"aria-label": "",
"copy-shortened-link": "",

Loading…
Cancel
Save