core-components: roll back translation of Link component

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2024-02-29 12:21:08 +01:00
parent b130eb36b4
commit 2ff3e6e8a6
4 changed files with 6 additions and 8 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/core-components': patch
---
The translation support for the `Link` component has been removed for now, in order to avoid broad breakages of tests in existing projects where the component is tested without being wrapped in an API provider.
@@ -9,7 +9,6 @@ import { TranslationRef } from '@backstage/core-plugin-api/alpha';
export const coreComponentsTranslationRef: TranslationRef<
'core-components',
{
readonly 'link.openNewWindow': 'Opens in a new window';
readonly 'table.filter.title': 'Filters';
readonly 'table.filter.clearAll': 'Clear all';
readonly 'signIn.title': 'Sign In';
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import { configApiRef, useAnalytics, useApi } from '@backstage/core-plugin-api';
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
// eslint-disable-next-line no-restricted-imports
import MaterialLink, {
LinkProps as MaterialLinkProps,
@@ -30,7 +29,6 @@ import {
LinkProps as RouterLinkProps,
Route,
} from 'react-router-dom';
import { coreComponentsTranslationRef } from '../../translation';
export function isReactRouterBeta(): boolean {
const [obj] = createRoutesFromChildren(<Route index element={<div />} />);
@@ -163,7 +161,6 @@ export const Link = React.forwardRef<any, LinkProps>(
({ onClick, noTrack, ...props }, ref) => {
const classes = useStyles();
const analytics = useAnalytics();
const { t } = useTranslationRef(coreComponentsTranslationRef);
// Adding the base path to URLs breaks react-router v6 stable, so we only
// do it for beta. The react router version won't change at runtime so it is
@@ -202,7 +199,7 @@ export const Link = React.forwardRef<any, LinkProps>(
>
{props.children}
<Typography component="span" className={classes.visuallyHidden}>
{`, ${t('link.openNewWindow')}`}
, Opens in a new window
</Typography>
</MaterialLink>
) : (
@@ -80,9 +80,6 @@ export const coreComponentsTranslationRef = createTranslationRef({
login: 'Log in',
rejectAll: 'Reject All',
},
link: {
openNewWindow: 'Opens in a new window',
},
supportButton: {
title: 'Support',
close: 'Close',