-
{`Cluster: ${
- c.cluster.title || c.cluster.name
- }`}
+
+ {t('errorPanel.clusterLabel')}: {c.cluster.title || c.cluster.name}
+
{c.errors.map((e, j) => {
return (
{e.errorType === 'FETCH_ERROR'
- ? `Error communicating with Kubernetes: ${e.errorType}, message: ${e.message}`
- : `Error fetching Kubernetes resource: '${e.resourcePath}', error: ${e.errorType}, status code: ${e.statusCode}`}
+ ? t('errorPanel.fetchError', {
+ errorType: e.errorType,
+ message: e.message,
+ })
+ : t('errorPanel.resourceError', {
+ resourcePath: e.resourcePath ?? '',
+ errorType: e.errorType,
+ statusCode: String(e.statusCode ?? ''),
+ })}
);
})}
@@ -64,16 +77,24 @@ export const ErrorPanel = ({
entityName,
errorMessage,
clustersWithErrors,
-}: ErrorPanelProps) => (
-
- {clustersWithErrors && (
- Errors: {clustersWithErrorsToErrorMessage(clustersWithErrors)}
- )}
- {errorMessage && (
- Errors: {errorMessage}
- )}
-
-);
+}: ErrorPanelProps) => {
+ const { t } = useTranslationRef(kubernetesReactTranslationRef);
+ return (
+
+ {clustersWithErrors && (
+
+ {t('errorPanel.errorsLabel')}:{' '}
+ {clustersWithErrorsToErrorMessage(clustersWithErrors, t)}
+
+ )}
+ {errorMessage && (
+
+ {t('errorPanel.errorsLabel')}: {errorMessage}
+
+ )}
+
+ );
+};
diff --git a/plugins/kubernetes-react/src/components/ErrorReporting/ErrorReporting.tsx b/plugins/kubernetes-react/src/components/ErrorReporting/ErrorReporting.tsx
index f9e86110c2..564fa37abc 100644
--- a/plugins/kubernetes-react/src/components/ErrorReporting/ErrorReporting.tsx
+++ b/plugins/kubernetes-react/src/components/ErrorReporting/ErrorReporting.tsx
@@ -19,6 +19,8 @@ import {
DetectedErrorsByCluster,
} from '@backstage/plugin-kubernetes-common';
import { Table, TableColumn } from '@backstage/core-components';
+import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
+import { kubernetesReactTranslationRef } from '../../translation';
/**
*
@@ -30,36 +32,6 @@ export type ErrorReportingProps = {
clusters: ClusterAttributes[];
};
-const columns: TableColumn
[] = [
- {
- title: 'cluster',
- width: '10%',
- render: (row: Row) => row.cluster.title || row.cluster.name,
- },
- {
- title: 'namespace',
- width: '10%',
- render: (row: Row) => row.error.sourceRef.namespace,
- },
- {
- title: 'kind',
- width: '10%',
- render: (row: Row) => row.error.sourceRef.kind,
- },
- {
- title: 'name',
- width: '30%',
- render: (row: Row) => {
- return <>{row.error.sourceRef.name} >;
- },
- },
- {
- title: 'messages',
- width: '40%',
- render: (row: Row) => row.error.message,
- },
-];
-
interface Row {
cluster: ClusterAttributes;
error: DetectedError;
@@ -83,6 +55,7 @@ export const ErrorReporting = ({
detectedErrors,
clusters,
}: ErrorReportingProps) => {
+ const { t } = useTranslationRef(kubernetesReactTranslationRef);
const errors = Array.from(detectedErrors.entries())
.flatMap(([clusterName, resourceErrors]) => {
return resourceErrors.map(e => ({
@@ -92,11 +65,41 @@ export const ErrorReporting = ({
})
.sort(sortBySeverity);
+ const columns: TableColumn[] = [
+ {
+ title: String(t('errorReporting.columns.cluster')),
+ width: '10%',
+ render: (row: Row) => row.cluster.title || row.cluster.name,
+ },
+ {
+ title: String(t('errorReporting.columns.namespace')),
+ width: '10%',
+ render: (row: Row) => row.error.sourceRef.namespace,
+ },
+ {
+ title: String(t('errorReporting.columns.kind')),
+ width: '10%',
+ render: (row: Row) => row.error.sourceRef.kind,
+ },
+ {
+ title: String(t('errorReporting.columns.name')),
+ width: '30%',
+ render: (row: Row) => {
+ return <>{row.error.sourceRef.name} >;
+ },
+ },
+ {
+ title: String(t('errorReporting.columns.messages')),
+ width: '40%',
+ render: (row: Row) => row.error.message,
+ },
+ ];
+
return (
<>
{errors.length !== 0 && (
{
+ const { t } = useTranslationRef(kubernetesReactTranslationRef);
const namespace = ingress.metadata?.namespace;
return (
{namespace && (
-
+
)}
diff --git a/plugins/kubernetes-react/src/components/KubernetesDialog/KubernetesDialog.tsx b/plugins/kubernetes-react/src/components/KubernetesDialog/KubernetesDialog.tsx
index d1a2a8a825..182265d23e 100644
--- a/plugins/kubernetes-react/src/components/KubernetesDialog/KubernetesDialog.tsx
+++ b/plugins/kubernetes-react/src/components/KubernetesDialog/KubernetesDialog.tsx
@@ -22,6 +22,8 @@ import IconButton from '@material-ui/core/IconButton';
import { Theme, createStyles, makeStyles } from '@material-ui/core/styles';
import CloseIcon from '@material-ui/icons/Close';
import { ReactNode, useState } from 'react';
+import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
+import { kubernetesReactTranslationRef } from '../../translation';
const useStyles = makeStyles((theme: Theme) =>
createStyles({
@@ -59,6 +61,7 @@ export const KubernetesDialog = ({
title,
}: KubernetesDialogProps) => {
const classes = useStyles();
+ const { t } = useTranslationRef(kubernetesReactTranslationRef);
const [open, setOpen] = useState(false);
const openDialog = () => {
@@ -80,7 +83,7 @@ export const KubernetesDialog = ({
{title}
diff --git a/plugins/kubernetes-react/src/components/KubernetesDrawer/KubernetesDrawer.tsx b/plugins/kubernetes-react/src/components/KubernetesDrawer/KubernetesDrawer.tsx
index 323ce650d9..aa0609ca06 100644
--- a/plugins/kubernetes-react/src/components/KubernetesDrawer/KubernetesDrawer.tsx
+++ b/plugins/kubernetes-react/src/components/KubernetesDrawer/KubernetesDrawer.tsx
@@ -31,6 +31,8 @@ import {
} from '@material-ui/core/styles';
import CloseIcon from '@material-ui/icons/Close';
import { ManifestYaml } from './ManifestYaml';
+import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
+import { kubernetesReactTranslationRef } from '../../translation';
const useDrawerContentStyles = makeStyles((_theme: Theme) =>
createStyles({
@@ -72,6 +74,7 @@ const KubernetesDrawerContent = ({
close,
}: KubernetesDrawerContentProps) => {
const classes = useDrawerContentStyles();
+ const { t } = useTranslationRef(kubernetesReactTranslationRef);
const [isYaml, setIsYaml] = useState(false);
return (
@@ -86,7 +89,7 @@ const KubernetesDrawerContent = ({
close()}
color="inherit"
>
@@ -104,10 +107,10 @@ const KubernetesDrawerContent = ({
onChange={event => {
setIsYaml(event.target.checked);
}}
- name="YAML"
+ name={t('kubernetesDrawer.yaml')}
/>
}
- label="YAML"
+ label={t('kubernetesDrawer.yaml')}
/>
diff --git a/plugins/kubernetes-react/src/components/KubernetesDrawer/KubernetesStructuredMetadataTableDrawer.tsx b/plugins/kubernetes-react/src/components/KubernetesDrawer/KubernetesStructuredMetadataTableDrawer.tsx
index fb52063177..fb9977fb4a 100644
--- a/plugins/kubernetes-react/src/components/KubernetesDrawer/KubernetesStructuredMetadataTableDrawer.tsx
+++ b/plugins/kubernetes-react/src/components/KubernetesDrawer/KubernetesStructuredMetadataTableDrawer.tsx
@@ -38,6 +38,8 @@ import { ManifestYaml } from './ManifestYaml';
import { useApi } from '@backstage/core-plugin-api';
import { kubernetesClusterLinkFormatterApiRef } from '../../api';
import useAsync from 'react-use/esm/useAsync';
+import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
+import { kubernetesReactTranslationRef } from '../../translation';
const useDrawerStyles = makeStyles((theme: Theme) =>
createStyles({
@@ -102,20 +104,24 @@ export type LinkErrorPanelProps = {
export const LinkErrorPanel = ({
cluster,
errorMessage,
-}: LinkErrorPanelProps) => (
-
- {errorMessage && (
- Errors: {errorMessage}
- )}
-
-);
+}: LinkErrorPanelProps) => {
+ const { t } = useTranslationRef(kubernetesReactTranslationRef);
+ return (
+
+ {errorMessage && (
+
+ {t('linkErrorPanel.errorsLabel')} {errorMessage}
+
+ )}
+
+ );
+};
/**
*
@@ -152,6 +158,7 @@ const KubernetesStructuredMetadataTableDrawerContent = <
renderObject,
kind,
}: KubernetesStructuredMetadataTableDrawerContentProps) => {
+ const { t } = useTranslationRef(kubernetesReactTranslationRef);
const [isYaml, setIsYaml] = useState(false);
const formatter = useApi(kubernetesClusterLinkFormatterApiRef);
@@ -175,13 +182,13 @@ const KubernetesStructuredMetadataTableDrawerContent = <
- {object.metadata?.name ?? 'unknown name'}
+ {object.metadata?.name ?? t('kubernetesDrawer.unknownName')}
toggleDrawer(e, false)}
color="inherit"
>
@@ -201,10 +208,10 @@ const KubernetesStructuredMetadataTableDrawerContent = <
onChange={event => {
setIsYaml(event.target.checked);
}}
- name="YAML"
+ name={t('kubernetesDrawer.yaml')}
/>
}
- label="YAML"
+ label={t('kubernetesDrawer.yaml')}
/>
diff --git a/plugins/kubernetes-react/src/components/KubernetesDrawer/ManifestYaml.tsx b/plugins/kubernetes-react/src/components/KubernetesDrawer/ManifestYaml.tsx
index 3ccd32fcfb..604efc3055 100644
--- a/plugins/kubernetes-react/src/components/KubernetesDrawer/ManifestYaml.tsx
+++ b/plugins/kubernetes-react/src/components/KubernetesDrawer/ManifestYaml.tsx
@@ -18,6 +18,8 @@ import FormControlLabel from '@material-ui/core/FormControlLabel';
import Switch from '@material-ui/core/Switch';
import jsyaml from 'js-yaml';
import { useState } from 'react';
+import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
+import { kubernetesReactTranslationRef } from '../../translation';
/**
* Props of ManifestYaml
@@ -34,6 +36,7 @@ export interface ManifestYamlProps {
* @public
*/
export const ManifestYaml = ({ object }: ManifestYamlProps) => {
+ const { t } = useTranslationRef(kubernetesReactTranslationRef);
// Toggle whether the Kubernetes resource managed fields should be shown in
// the YAML display. This toggle is only available when the YAML is being
// shown because managed fields are never visible in the structured display.
@@ -47,10 +50,10 @@ export const ManifestYaml = ({ object }: ManifestYamlProps) => {
onChange={event => {
setManagedFields(event.target.checked);
}}
- name="Managed Fields"
+ name={t('kubernetesDrawer.managedFields')}
/>
}
- label="Managed Fields"
+ label={t('kubernetesDrawer.managedFields')}
/>
{
const { cluster, containerName, podName } = props;
-
+ const { t } = useTranslationRef(kubernetesReactTranslationRef);
const isPodExecTerminalSupported = useIsPodExecTerminalSupported();
return (
!isPodExecTerminalSupported.loading &&
isPodExecTerminalSupported.value && (
}
- buttonText="Terminal"
+ buttonText={t('podExecTerminal.buttonText')}
disabled={
isPodExecTerminalSupported.loading ||
!isPodExecTerminalSupported.value
}
- title={`${podName} - ${containerName} terminal shell on cluster ${
- cluster.title || cluster.name
- }`}
+ title={t('podExecTerminal.titleTemplate', {
+ podName,
+ containerName,
+ clusterName: cluster.title || cluster.name,
+ })}
>
diff --git a/plugins/kubernetes-react/src/components/Pods/Events/Events.tsx b/plugins/kubernetes-react/src/components/Pods/Events/Events.tsx
index 94fc768e61..dc6abb6fd9 100644
--- a/plugins/kubernetes-react/src/components/Pods/Events/Events.tsx
+++ b/plugins/kubernetes-react/src/components/Pods/Events/Events.tsx
@@ -31,6 +31,8 @@ import { useEvents } from './useEvents';
import Skeleton from '@material-ui/lab/Skeleton';
import { DismissableBanner } from '@backstage/core-components';
import { Event } from 'kubernetes-models/v1';
+import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
+import { kubernetesReactTranslationRef } from '../../../translation';
/**
* Props for Events
@@ -59,8 +61,9 @@ export const EventsContent = ({
events,
warningEventsOnly,
}: EventsContentProps) => {
+ const { t } = useTranslationRef(kubernetesReactTranslationRef);
if (events.length === 0) {
- return No events found;
+ return {t('events.noEventsFound')};
}
return (
diff --git a/plugins/kubernetes-react/src/components/Pods/FixDialog/FixDialog.tsx b/plugins/kubernetes-react/src/components/Pods/FixDialog/FixDialog.tsx
index 644c17606b..65961dc22d 100644
--- a/plugins/kubernetes-react/src/components/Pods/FixDialog/FixDialog.tsx
+++ b/plugins/kubernetes-react/src/components/Pods/FixDialog/FixDialog.tsx
@@ -35,6 +35,8 @@ import { Events } from '../Events';
import { LinkButton } from '@backstage/core-components';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
+import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
+import { kubernetesReactTranslationRef } from '../../../translation';
const useStyles = makeStyles((theme: Theme) =>
createStyles({
@@ -72,6 +74,7 @@ export const FixDialog: FC = ({
}: FixDialogProps) => {
const [isOpen, setOpen] = useState(!!open);
const classes = useStyles();
+ const { t } = useTranslationRef(kubernetesReactTranslationRef);
const openDialog = () => {
setOpen(true);
@@ -87,21 +90,27 @@ export const FixDialog: FC = ({
return (
- Detected error:
+ {t('fixDialog.detectedError')}
{error.message}
- Cause explanation:
+
+ {t('fixDialog.causeExplanation')}
+
- {error.proposedFix?.rootCauseExplanation ?? 'unknown'}
+ {error.proposedFix?.rootCauseExplanation ?? t('podsTable.unknown')}
- Fix:
+ {t('fixDialog.fix')}
{(error.proposedFix?.actions ?? []).map((fix, i) => {
return (
-
+
{fix}
);
@@ -112,14 +121,15 @@ export const FixDialog: FC = ({
{pf && pf.type === 'logs' && (
<>
- Crash logs:
+ {t('fixDialog.crashLogs')}
= ({
{pf && pf.type === 'events' && (
<>
- Events:
+ {t('fixDialog.events')}
= ({
<>
}
>
- Help
+ {t('fixDialog.helpButton')}
- Your Clusters
+
+ {t('kubernetesContentPage.title')}
+
{kubernetesObjects?.items.length <= 0 && (
@@ -111,8 +116,11 @@ export const KubernetesContent = ({
diff --git a/plugins/kubernetes/src/alpha/translation.ts b/plugins/kubernetes/src/alpha/translation.ts
index 7f9704af84..238bd3b084 100644
--- a/plugins/kubernetes/src/alpha/translation.ts
+++ b/plugins/kubernetes/src/alpha/translation.ts
@@ -25,6 +25,14 @@ export const kubernetesTranslationRef = createTranslationRef({
message:
"To view Kubernetes objects, contact your portal administrator to give you the 'kubernetes.clusters.read' and 'kubernetes.resources.read' permission.",
},
+ title: 'Your Clusters',
+ emptyState: {
+ title: 'No Kubernetes resources',
+ description: 'No resources on any known clusters for {{entityName}}',
+ },
+ },
+ entityContent: {
+ title: 'Kubernetes',
},
},
});