Merge pull request #31674 from its-mitesh-kumar/feat/kubernetes-localization

fix(kubernetes): add missing i18n support for kubernetes and kubernetes-react plugin
This commit is contained in:
Ben Lambert
2025-11-25 10:42:46 +01:00
committed by GitHub
35 changed files with 680 additions and 266 deletions
+11 -3
View File
@@ -31,6 +31,8 @@ import {
} from '@backstage/plugin-kubernetes-common';
import { EmptyState, Progress } from '@backstage/core-components';
import { RequireKubernetesPermissions } from './RequireKubernetesPermissions';
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
import { kubernetesTranslationRef } from './alpha/translation';
type KubernetesContentProps = {
entity: Entity;
@@ -46,6 +48,7 @@ export const KubernetesContent = ({
entity,
refreshIntervalMs,
);
const { t } = useTranslationRef(kubernetesTranslationRef);
const clusters = kubernetesObjects?.items.map(item => item.cluster) ?? [];
@@ -97,7 +100,9 @@ export const KubernetesContent = ({
/>
</Grid>
<Grid item>
<Typography variant="h3">Your Clusters</Typography>
<Typography variant="h3">
{t('kubernetesContentPage.title')}
</Typography>
</Grid>
<Grid item container>
{kubernetesObjects?.items.length <= 0 && (
@@ -111,8 +116,11 @@ export const KubernetesContent = ({
<Grid item xs={8}>
<EmptyState
missing="data"
title="No Kubernetes resources"
description={`No resources on any known clusters for ${entity.metadata.name}`}
title={t('kubernetesContentPage.emptyState.title')}
description={t(
'kubernetesContentPage.emptyState.description',
{ entityName: entity.metadata.name },
)}
/>
</Grid>
</Grid>
@@ -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',
},
},
});