diff --git a/.changeset/poor-dodos-wait.md b/.changeset/poor-dodos-wait.md new file mode 100644 index 0000000000..f1d0b4e941 --- /dev/null +++ b/.changeset/poor-dodos-wait.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder': patch +--- + +Add translation to the editor toolbar component. diff --git a/plugins/scaffolder/report-alpha.api.md b/plugins/scaffolder/report-alpha.api.md index 2a90efc0ba..8d0abc262f 100644 --- a/plugins/scaffolder/report-alpha.api.md +++ b/plugins/scaffolder/report-alpha.api.md @@ -321,6 +321,14 @@ export const scaffolderTranslationRef: TranslationRef< readonly 'templateWizardPage.subtitle': 'Create new software components using standard templates in your organization'; readonly 'templateWizardPage.pageTitle': 'Create a new component'; readonly 'templateWizardPage.pageContextMenu.editConfigurationTitle': 'Edit Configuration'; + readonly 'templateEditorToolbar.customFieldExplorerTooltip': 'Custom Fields Explorer'; + readonly 'templateEditorToolbar.installedActionsDocumentationTooltip': 'Installed Actions Documentation'; + readonly 'templateEditorToolbar.addToCatalogButton': 'Publish'; + readonly 'templateEditorToolbar.addToCatalogDialogTitle': 'Publish changes'; + readonly 'templateEditorToolbar.addToCatalogDialogContent.stepsIntroduction': 'Follow the instructions below to create or update a template:'; + readonly 'templateEditorToolbar.addToCatalogDialogContent.stepsListItems': 'Save the template files in a local directory\nCreate a pull request to a new or existing git repository\nIf the template already exists, the changes will be reflected in the software catalog once the pull request gets merged\nBut if you are creating a new template, follow the documentation linked below to register the new template repository in software catalog'; + readonly 'templateEditorToolbar.addToCatalogDialogActions.documentationUrl': 'https://backstage.io/docs/features/software-templates/adding-templates/'; + readonly 'templateEditorToolbar.addToCatalogDialogActions.documentationButton': 'Go to the documentation'; } >; diff --git a/plugins/scaffolder/src/alpha/components/TemplateEditorPage/TemplateEditorToolbar.tsx b/plugins/scaffolder/src/alpha/components/TemplateEditorPage/TemplateEditorToolbar.tsx index a33915ae01..8e3124f833 100644 --- a/plugins/scaffolder/src/alpha/components/TemplateEditorPage/TemplateEditorToolbar.tsx +++ b/plugins/scaffolder/src/alpha/components/TemplateEditorPage/TemplateEditorToolbar.tsx @@ -31,11 +31,12 @@ import DialogActions from '@material-ui/core/DialogActions'; import ExtensionIcon from '@material-ui/icons/Extension'; import DescriptionIcon from '@material-ui/icons/Description'; -import { Link } from '@backstage/core-components'; import { FieldExtensionOptions } from '@backstage/plugin-scaffolder-react'; import { ActionPageContent } from '../../../components/ActionsPage/ActionsPage'; import { CustomFieldPlaygroud } from './CustomFieldPlaygroud'; +import { useTranslationRef } from '@backstage/frontend-plugin-api'; +import { scaffolderTranslationRef } from '../../../translation'; const useStyles = makeStyles( theme => ({ @@ -73,6 +74,7 @@ export function TemplateEditorToolbar(props: { }) { const { children, fieldExtensions } = props; const classes = useStyles(); + const { t } = useTranslationRef(scaffolderTranslationRef); const [showFieldsDrawer, setShowFieldsDrawer] = useState(false); const [showActionsDrawer, setShowActionsDrawer] = useState(false); const [showPublishModal, setShowPublishModal] = useState(false); @@ -86,17 +88,25 @@ export function TemplateEditorToolbar(props: { variant="outlined" color="primary" > - + - + - + - Publish changes + + {t('templateEditorToolbar.addToCatalogDialogTitle')} + - Follow the instructions below to create or update a template: -
    -
  1. Save the template files in a local directory
  2. -
  3. - Create a pull request to a new or existing git repository -
  4. -
  5. - If the template already exists, the changes will be reflected - in the software catalog once the pull request gets merged -
  6. -
  7. - But if you are creating a new template, follow this{' '} - - documentation - {' '} - to register the new template repository in software catalog -
  8. -
+ {t( + 'templateEditorToolbar.addToCatalogDialogContent.stepsIntroduction', + )} +
    + {t( + 'templateEditorToolbar.addToCatalogDialogContent.stepsListItems', + ) + .split('\n') + .map((step, index) => ( +
  • {step}
  • + ))} +
- diff --git a/plugins/scaffolder/src/translation.ts b/plugins/scaffolder/src/translation.ts index 11c13194ce..4399678948 100644 --- a/plugins/scaffolder/src/translation.ts +++ b/plugins/scaffolder/src/translation.ts @@ -298,5 +298,22 @@ export const scaffolderTranslationRef = createTranslationRef({ editConfigurationTitle: 'Edit Configuration', }, }, + templateEditorToolbar: { + customFieldExplorerTooltip: 'Custom Fields Explorer', + installedActionsDocumentationTooltip: 'Installed Actions Documentation', + addToCatalogButton: 'Publish', + addToCatalogDialogTitle: 'Publish changes', + addToCatalogDialogContent: { + stepsIntroduction: + 'Follow the instructions below to create or update a template:', + stepsListItems: + 'Save the template files in a local directory\nCreate a pull request to a new or existing git repository\nIf the template already exists, the changes will be reflected in the software catalog once the pull request gets merged\nBut if you are creating a new template, follow the documentation linked below to register the new template repository in software catalog', + }, + addToCatalogDialogActions: { + documentationButton: 'Go to the documentation', + documentationUrl: + 'https://backstage.io/docs/features/software-templates/adding-templates/', + }, + }, }, });