From 220d6c3f70347adc9ab34a586ee4f09b2f1195a8 Mon Sep 17 00:00:00 2001 From: Eswaraiahsapram Date: Mon, 3 Nov 2025 12:48:09 +0530 Subject: [PATCH] fix: add missing i18n support for catalog plugin Signed-off-by: Eswaraiahsapram --- .changeset/empty-games-hug.md | 5 +++++ .../alpha/components/EntityLayout/EntityLayout.tsx | 4 ++-- .../alpha/components/EntityTabs/EntityTabsList.tsx | 8 ++++++-- plugins/catalog/src/alpha/translation.ts | 14 ++++++++++++++ .../catalog/src/components/AboutCard/AboutCard.tsx | 4 ++-- .../src/components/AboutCard/AboutContent.tsx | 2 +- .../src/components/AboutCard/AboutField.tsx | 5 ++++- .../CatalogSearchResultListItem.tsx | 14 ++++++++++++-- .../src/components/CatalogTable/CatalogTable.tsx | 4 +++- .../EntityContextMenu/EntityContextMenu.tsx | 2 +- .../src/components/EntityLayout/EntityLayout.tsx | 4 ++-- 11 files changed, 52 insertions(+), 14 deletions(-) create mode 100644 .changeset/empty-games-hug.md diff --git a/.changeset/empty-games-hug.md b/.changeset/empty-games-hug.md new file mode 100644 index 0000000000..b588f440dd --- /dev/null +++ b/.changeset/empty-games-hug.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog': patch +--- + +Added missing i18n diff --git a/plugins/catalog/src/alpha/components/EntityLayout/EntityLayout.tsx b/plugins/catalog/src/alpha/components/EntityLayout/EntityLayout.tsx index dbe25e9401..e881135a9a 100644 --- a/plugins/catalog/src/alpha/components/EntityLayout/EntityLayout.tsx +++ b/plugins/catalog/src/alpha/components/EntityLayout/EntityLayout.tsx @@ -180,9 +180,9 @@ export const EntityLayout = (props: EntityLayoutProps) => { NotFoundComponent ) : ( - There is no {kind} with the requested{' '} + {t('entityLayout.notFoundMessage', { kind })}{' '} - kind, namespace, and name + {t('entityLayout.notFoundLinkText')} . diff --git a/plugins/catalog/src/alpha/components/EntityTabs/EntityTabsList.tsx b/plugins/catalog/src/alpha/components/EntityTabs/EntityTabsList.tsx index dae400ce5d..d77cc5e444 100644 --- a/plugins/catalog/src/alpha/components/EntityTabs/EntityTabsList.tsx +++ b/plugins/catalog/src/alpha/components/EntityTabs/EntityTabsList.tsx @@ -18,9 +18,12 @@ import { ReactElement, useMemo } from 'react'; import Box from '@material-ui/core/Box'; import Tabs from '@material-ui/core/Tabs'; import { makeStyles } from '@material-ui/core/styles'; -import { EntityTabsGroup } from './EntityTabsGroup'; +import { useTranslationRef } from '@backstage/core-plugin-api/alpha'; import { EntityContentGroupDefinitions } from '@backstage/plugin-catalog-react/alpha'; +import { EntityTabsGroup } from './EntityTabsGroup'; +import { catalogTranslationRef } from '../../translation'; + /** @public */ export type HeaderTabsClassKey = | 'tabsWrapper' @@ -81,6 +84,7 @@ type EntityTabsListProps = { export function EntityTabsList(props: EntityTabsListProps) { const styles = useStyles(); + const { t } = useTranslationRef(catalogTranslationRef); const { tabs: items, selectedIndex = 0, showIcons, groupDefinitions } = props; @@ -108,7 +112,7 @@ export function EntityTabsList(props: EntityTabsListProps) { textColor="inherit" variant="scrollable" scrollButtons="auto" - aria-label="tabs" + aria-label={t('entityTabs.tabsAriaLabel')} value={selectedItem?.group ?? selectedItem?.id} > {Object.entries(groups).map(([id, tabGroup]) => ( diff --git a/plugins/catalog/src/alpha/translation.ts b/plugins/catalog/src/alpha/translation.ts index 498104db45..885caeb280 100644 --- a/plugins/catalog/src/alpha/translation.ts +++ b/plugins/catalog/src/alpha/translation.ts @@ -25,15 +25,22 @@ export const catalogTranslationRef = createTranslationRef({ createButtonTitle: 'Create', supportButtonContent: 'All your software catalog entities', }, + entityLayout: { + notFoundMessage: 'There is no {{kind}} with the requested', + notFoundLinkText: 'kind, namespace, and name', + }, aboutCard: { title: 'About', refreshButtonTitle: 'Schedule entity refresh', editButtonTitle: 'Edit Metadata', + editButtonAriaLabel: 'Edit', createSimilarButtonTitle: 'Create something similar', refreshScheduledMessage: 'Refresh scheduled', + refreshButtonAriaLabel: 'Refresh', launchTemplate: 'Launch Template', viewTechdocs: 'View TechDocs', viewSource: 'View Source', + unknown: 'unknown', descriptionField: { label: 'Description', value: 'No description', @@ -69,6 +76,8 @@ export const catalogTranslationRef = createTranslationRef({ }, }, searchResultItem: { + kind: 'Kind', + type: 'Type', lifecycle: 'Lifecycle', Owner: 'Owner', }, @@ -78,6 +87,7 @@ export const catalogTranslationRef = createTranslationRef({ editActionTitle: 'Edit', starActionTitle: 'Add to favorites', unStarActionTitle: 'Remove from favorites', + allFilters: 'All', }, dependencyOfComponentsCard: { title: 'Dependency of components', @@ -97,6 +107,7 @@ export const catalogTranslationRef = createTranslationRef({ inspectMenuTitle: 'Inspect entity', copyURLMenuTitle: 'Copy entity URL', unregisterMenuTitle: 'Unregister entity', + moreButtonAriaLabel: 'more', }, entityLabelsCard: { title: 'Labels', @@ -121,6 +132,9 @@ export const catalogTranslationRef = createTranslationRef({ 'Want to help us build this? Check out our Getting Started documentation.', docButtonTitle: 'DOCS', }, + entityTabs: { + tabsAriaLabel: 'Tabs', + }, deleteEntity: { dialogTitle: 'Are you sure you want to delete this entity?', deleteButtonTitle: 'Delete', diff --git a/plugins/catalog/src/components/AboutCard/AboutCard.tsx b/plugins/catalog/src/components/AboutCard/AboutCard.tsx index fd1c05ba5f..8e90659520 100644 --- a/plugins/catalog/src/components/AboutCard/AboutCard.tsx +++ b/plugins/catalog/src/components/AboutCard/AboutCard.tsx @@ -241,7 +241,7 @@ export function InternalAboutCard(props: InternalAboutCardProps) { <> {allowRefresh && canRefresh && ( @@ -250,7 +250,7 @@ export function InternalAboutCard(props: InternalAboutCardProps) { )} ({ value: { @@ -55,6 +57,7 @@ export interface AboutFieldProps { export function AboutField(props: AboutFieldProps) { const { label, value, gridSizes, children, className } = props; const classes = useStyles(); + const { t } = useTranslationRef(catalogTranslationRef); const childElements = useElementFilter(children, c => c.getElements()); @@ -64,7 +67,7 @@ export function AboutField(props: AboutFieldProps) { childElements ) : ( - {value || `unknown`} + {value || t('aboutCard.unknown')} ); return ( diff --git a/plugins/catalog/src/components/CatalogSearchResultListItem/CatalogSearchResultListItem.tsx b/plugins/catalog/src/components/CatalogSearchResultListItem/CatalogSearchResultListItem.tsx index f33c9cd412..fac38aa7af 100644 --- a/plugins/catalog/src/components/CatalogSearchResultListItem/CatalogSearchResultListItem.tsx +++ b/plugins/catalog/src/components/CatalogSearchResultListItem/CatalogSearchResultListItem.tsx @@ -127,8 +127,18 @@ export function CatalogSearchResultListItem( } /> - {result.kind && } - {result.type && } + {result.kind && ( + + )} + {result.type && ( + + )} {result.lifecycle && ( { const currentType = filters.type?.value || ''; const currentCount = typeof totalItems === 'number' ? `(${totalItems})` : ''; // TODO(timbonicus): remove the title from the CatalogTable once using EntitySearchBar - const titlePreamble = capitalize(filters.user?.value ?? 'all'); + const titlePreamble = capitalize( + filters.user?.value ?? t('catalogTable.allFilters'), + ); const title = props.title || [titlePreamble, currentType, pluralize(currentKind), currentCount] diff --git a/plugins/catalog/src/components/EntityContextMenu/EntityContextMenu.tsx b/plugins/catalog/src/components/EntityContextMenu/EntityContextMenu.tsx index 2d9c392322..23dc9c1efb 100644 --- a/plugins/catalog/src/components/EntityContextMenu/EntityContextMenu.tsx +++ b/plugins/catalog/src/components/EntityContextMenu/EntityContextMenu.tsx @@ -161,7 +161,7 @@ export function EntityContextMenu(props: EntityContextMenuProps) { <> { NotFoundComponent ) : ( - There is no {kind} with the requested{' '} + {t('entityLayout.notFoundMessage', { kind })}{' '} - kind, namespace, and name + {t('entityLayout.notFoundLinkText')} .