From d1ce7a47d97d0c58c52418dd7d8c6e20733691e9 Mon Sep 17 00:00:00 2001 From: JounQin Date: Tue, 11 Mar 2025 21:48:41 +0800 Subject: [PATCH] docs: add more about prop signature change details Signed-off-by: JounQin --- .changeset/neat-glasses-occur.md | 8 +++++++- plugins/catalog-import/report.api.md | 1 + .../src/components/ImportStepper/ImportStepper.tsx | 4 +++- .../src/components/ImportStepper/defaults.tsx | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.changeset/neat-glasses-occur.md b/.changeset/neat-glasses-occur.md index 4e5e62b7ca..dedb576dc0 100644 --- a/.changeset/neat-glasses-occur.md +++ b/.changeset/neat-glasses-occur.md @@ -1,5 +1,11 @@ --- -'@backstage/plugin-catalog-import': patch +'@backstage/plugin-catalog-import': minor --- Add i18n support for catalog-import plugin + +`ImportStepper` component now supports i18n, it's `generateStepper` prop now +accepts a third `t: TranslationFunction` +function from `@backstage/core-plugin-api/alpha` and uses it to translate the +stepper steps, checkout `catalogImportTranslationRef` from `@backstage/plugin-catalog-import/alpha` +for more details. diff --git a/plugins/catalog-import/report.api.md b/plugins/catalog-import/report.api.md index eed2639168..ed7d2f3347 100644 --- a/plugins/catalog-import/report.api.md +++ b/plugins/catalog-import/report.api.md @@ -216,6 +216,7 @@ export interface ImportStepperProps { generateStepper?: ( flow: ImportFlows, defaults: StepperProvider, + t: TranslationFunction, ) => StepperProvider; // (undocumented) initialUrl?: string; diff --git a/plugins/catalog-import/src/components/ImportStepper/ImportStepper.tsx b/plugins/catalog-import/src/components/ImportStepper/ImportStepper.tsx index ed399a8a96..614751c292 100644 --- a/plugins/catalog-import/src/components/ImportStepper/ImportStepper.tsx +++ b/plugins/catalog-import/src/components/ImportStepper/ImportStepper.tsx @@ -16,7 +16,9 @@ import { InfoCard, InfoCardVariants } from '@backstage/core-components'; import { useApi } from '@backstage/core-plugin-api'; +import { TranslationFunction } from '@backstage/core-plugin-api/alpha'; import { useTranslationRef } from '@backstage/frontend-plugin-api'; +import { catalogImportTranslationRef } from '@backstage/plugin-catalog-import/alpha'; import Step from '@material-ui/core/Step'; import StepContent from '@material-ui/core/StepContent'; import Stepper from '@material-ui/core/Stepper'; @@ -24,7 +26,6 @@ import { makeStyles } from '@material-ui/core/styles'; import { useMemo } from 'react'; import { catalogImportApiRef } from '../../api'; -import { catalogImportTranslationRef } from '../../translation'; import { ImportFlows, ImportState, useImportState } from '../useImportState'; import { defaultGenerateStepper, @@ -49,6 +50,7 @@ export interface ImportStepperProps { generateStepper?: ( flow: ImportFlows, defaults: StepperProvider, + t: TranslationFunction, ) => StepperProvider; variant?: InfoCardVariants; } diff --git a/plugins/catalog-import/src/components/ImportStepper/defaults.tsx b/plugins/catalog-import/src/components/ImportStepper/defaults.tsx index 2b8f7e107b..7d597c75ad 100644 --- a/plugins/catalog-import/src/components/ImportStepper/defaults.tsx +++ b/plugins/catalog-import/src/components/ImportStepper/defaults.tsx @@ -86,6 +86,7 @@ export interface StepperProvider { * * @param flow - the name of the active flow * @param defaults - the default steps + * @param t - the translation function * @public */ export function defaultGenerateStepper(