i18n: Markup CorrelationsPage for translations (#74892)

* i18n: Translations under features/correlations

* more changes

* add links

* add changes

* changes

* changes
This commit is contained in:
Khushi Jain 2023-09-29 19:29:30 +05:30 committed by GitHub
parent 43d0193ea6
commit b75c7b4c49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 141 additions and 15 deletions

View File

@ -1,13 +1,16 @@
import React from 'react'; import React from 'react';
import { Page } from 'app/core/components/Page/Page'; import { Page } from 'app/core/components/Page/Page';
import { Trans } from 'app/core/internationalization';
export default function FeatureTogglePage() { export default function FeatureTogglePage() {
return ( return (
<Page navId="correlations"> <Page navId="correlations">
<Page.Contents> <Page.Contents>
<h1>Correlations are disabled</h1> <h1>
To enable Correlations, add it in the Grafana config: <Trans i18nKey="correlations.page-heading">Correlations are disabled</Trans>
</h1>
<Trans i18nKey="correlations.page-content">To enable Correlations, add it in the Grafana config:</Trans>
<div> <div>
<pre> <pre>
{`[feature_toggles] {`[feature_toggles]

View File

@ -21,6 +21,7 @@ import {
import { Page } from 'app/core/components/Page/Page'; import { Page } from 'app/core/components/Page/Page';
import { contextSrv } from 'app/core/core'; import { contextSrv } from 'app/core/core';
import { useNavModel } from 'app/core/hooks/useNavModel'; import { useNavModel } from 'app/core/hooks/useNavModel';
import { Trans, t } from 'app/core/internationalization';
import { AccessControlAction } from 'app/types'; import { AccessControlAction } from 'app/types';
import { AddCorrelationForm } from './Forms/AddCorrelationForm'; import { AddCorrelationForm } from './Forms/AddCorrelationForm';
@ -100,7 +101,7 @@ export default function CorrelationsPage() {
return ( return (
!provisioned && ( !provisioned && (
<DeleteButton <DeleteButton
aria-label="delete correlation" aria-label={t('correlations.list.delete', 'delete correlation')}
onConfirm={() => onConfirm={() =>
handleDelete({ sourceUID, uid }, page.current > 1 && index === 0 && data?.correlations.length === 1) handleDelete({ sourceUID, uid }, page.current > 1 && index === 0 && data?.correlations.length === 1)
} }
@ -123,17 +124,17 @@ export default function CorrelationsPage() {
}, },
{ {
id: 'source', id: 'source',
header: 'Source', header: t('correlations.list.source', 'Source'),
cell: DataSourceCell, cell: DataSourceCell,
sortType: sortDatasource, sortType: sortDatasource,
}, },
{ {
id: 'target', id: 'target',
header: 'Target', header: t('correlations.list.target', 'Target'),
cell: DataSourceCell, cell: DataSourceCell,
sortType: sortDatasource, sortType: sortDatasource,
}, },
{ id: 'label', header: 'Label', sortType: 'alphanumeric' }, { id: 'label', header: t('correlations.list.label', 'Label'), sortType: 'alphanumeric' },
{ {
id: 'actions', id: 'actions',
cell: RowActions, cell: RowActions,
@ -148,7 +149,7 @@ export default function CorrelationsPage() {
const showEmptyListCTA = data?.correlations.length === 0 && !isAdding && !get.error; const showEmptyListCTA = data?.correlations.length === 0 && !isAdding && !get.error;
const addButton = canWriteCorrelations && data?.correlations?.length !== 0 && data !== undefined && !isAdding && ( const addButton = canWriteCorrelations && data?.correlations?.length !== 0 && data !== undefined && !isAdding && (
<Button icon="plus" onClick={() => setIsAdding(true)}> <Button icon="plus" onClick={() => setIsAdding(true)}>
Add new <Trans i18nKey="correlations.add-new">Add new</Trans>
</Button> </Button>
); );
@ -157,10 +158,17 @@ export default function CorrelationsPage() {
navModel={navModel} navModel={navModel}
subTitle={ subTitle={
<> <>
<Trans i18nKey="correlations.sub-title">
Define how data living in different data sources relates to each other. Read more in the{' '} Define how data living in different data sources relates to each other. Read more in the{' '}
<a href="https://grafana.com/docs/grafana/next/administration/correlations/" target="_blank" rel="noreferrer"> <a
documentation <Icon name="external-link-alt" /> href="https://grafana.com/docs/grafana/next/administration/correlations/"
target="_blank"
rel="noreferrer"
>
documentation
<Icon name="external-link-alt" />
</a> </a>
</Trans>
</> </>
} }
actions={addButton} actions={addButton}
@ -169,7 +177,7 @@ export default function CorrelationsPage() {
<div> <div>
{!data && get.loading && ( {!data && get.loading && (
<div className={loaderWrapper}> <div className={loaderWrapper}>
<LoadingPlaceholder text="loading..." /> <LoadingPlaceholder text={t('correlations.list.loading', 'loading...')} />
</div> </div>
)} )}
@ -180,9 +188,16 @@ export default function CorrelationsPage() {
{ {
// This error is not actionable, it'd be nice to have a recovery button // This error is not actionable, it'd be nice to have a recovery button
get.error && ( get.error && (
<Alert severity="error" title="Error fetching correlation data" topSpacing={2}> <Alert
severity="error"
title={t('correlations.alert.title', 'Error fetching correlation data')}
topSpacing={2}
>
{(isFetchError(get.error) && get.error.data?.message) || {(isFetchError(get.error) && get.error.data?.message) ||
'An unknown error occurred while fetching correlation data. Please try again.'} t(
'correlations.alert.error-message',
'An unknown error occurred while fetching correlation data. Please try again.'
)}
</Alert> </Alert>
) )
} }
@ -279,7 +294,7 @@ const InfoCell = memo(
const readOnly = props.row.original.provisioned; const readOnly = props.row.original.provisioned;
if (readOnly) { if (readOnly) {
return <Badge text="Read only" color="purple" className={noWrap} />; return <Badge text={t('correlations.list.read-only', 'Read only')} color="purple" className={noWrap} />;
} else { } else {
return null; return null;
} }

View File

@ -126,6 +126,24 @@
"placeholder": "" "placeholder": ""
} }
}, },
"correlations": {
"add-new": "",
"alert": {
"error-message": "",
"title": ""
},
"list": {
"delete": "",
"label": "",
"loading": "",
"read-only": "",
"source": "",
"target": ""
},
"page-content": "",
"page-heading": "",
"sub-title": ""
},
"dashboard": { "dashboard": {
"add-menu": { "add-menu": {
"import": "Aus Bibliothek importieren", "import": "Aus Bibliothek importieren",

View File

@ -126,6 +126,24 @@
"placeholder": "Search all" "placeholder": "Search all"
} }
}, },
"correlations": {
"add-new": "Add new",
"alert": {
"error-message": "An unknown error occurred while fetching correlation data. Please try again.",
"title": "Error fetching correlation data"
},
"list": {
"delete": "delete correlation",
"label": "Label",
"loading": "loading...",
"read-only": "Read only",
"source": "Source",
"target": "Target"
},
"page-content": "To enable Correlations, add it in the Grafana config:",
"page-heading": "Correlations are disabled",
"sub-title": "Define how data living in different data sources relates to each other. Read more in the <2>documentation<1></1></2>"
},
"dashboard": { "dashboard": {
"add-menu": { "add-menu": {
"import": "Import from library", "import": "Import from library",

View File

@ -131,6 +131,24 @@
"placeholder": "" "placeholder": ""
} }
}, },
"correlations": {
"add-new": "",
"alert": {
"error-message": "",
"title": ""
},
"list": {
"delete": "",
"label": "",
"loading": "",
"read-only": "",
"source": "",
"target": ""
},
"page-content": "",
"page-heading": "",
"sub-title": ""
},
"dashboard": { "dashboard": {
"add-menu": { "add-menu": {
"import": "Importar de la biblioteca", "import": "Importar de la biblioteca",

View File

@ -131,6 +131,24 @@
"placeholder": "" "placeholder": ""
} }
}, },
"correlations": {
"add-new": "",
"alert": {
"error-message": "",
"title": ""
},
"list": {
"delete": "",
"label": "",
"loading": "",
"read-only": "",
"source": "",
"target": ""
},
"page-content": "",
"page-heading": "",
"sub-title": ""
},
"dashboard": { "dashboard": {
"add-menu": { "add-menu": {
"import": "Importer depuis la bibliothèque", "import": "Importer depuis la bibliothèque",

View File

@ -126,6 +126,24 @@
"placeholder": "Ŝęäřčĥ äľľ" "placeholder": "Ŝęäřčĥ äľľ"
} }
}, },
"correlations": {
"add-new": "Åđđ ʼnęŵ",
"alert": {
"error-message": "Åʼn ūʼnĸʼnőŵʼn ęřřőř őččūřřęđ ŵĥįľę ƒęŧčĥįʼnģ čőřřęľäŧįőʼn đäŧä. Pľęäşę ŧřy äģäįʼn.",
"title": "Ēřřőř ƒęŧčĥįʼnģ čőřřęľäŧįőʼn đäŧä"
},
"list": {
"delete": "đęľęŧę čőřřęľäŧįőʼn",
"label": "Ŀäþęľ",
"loading": "ľőäđįʼnģ...",
"read-only": "Ŗęäđ őʼnľy",
"source": "Ŝőūřčę",
"target": "Ŧäřģęŧ"
},
"page-content": "Ŧő ęʼnäþľę Cőřřęľäŧįőʼnş, äđđ įŧ įʼn ŧĥę Ğřäƒäʼnä čőʼnƒįģ:",
"page-heading": "Cőřřęľäŧįőʼnş äřę đįşäþľęđ",
"sub-title": "Đęƒįʼnę ĥőŵ đäŧä ľįvįʼnģ įʼn đįƒƒęřęʼnŧ đäŧä şőūřčęş řęľäŧęş ŧő ęäčĥ őŧĥęř. Ŗęäđ mőřę įʼn ŧĥę <2>đőčūmęʼnŧäŧįőʼn<1></1></2>"
},
"dashboard": { "dashboard": {
"add-menu": { "add-menu": {
"import": "Ĩmpőřŧ ƒřőm ľįþřäřy", "import": "Ĩmpőřŧ ƒřőm ľįþřäřy",

View File

@ -121,6 +121,24 @@
"placeholder": "" "placeholder": ""
} }
}, },
"correlations": {
"add-new": "",
"alert": {
"error-message": "",
"title": ""
},
"list": {
"delete": "",
"label": "",
"loading": "",
"read-only": "",
"source": "",
"target": ""
},
"page-content": "",
"page-heading": "",
"sub-title": ""
},
"dashboard": { "dashboard": {
"add-menu": { "add-menu": {
"import": "从库导入", "import": "从库导入",