Skip to content

Commit 72968bb

Browse files
authored
Merge pull request backstage#23329 from backstage/rugvip/linkrollback
core-components: roll back translation of Link component
2 parents 5848386 + 2ff3e6e commit 72968bb

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

.changeset/curvy-carrots-dream.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@backstage/core-components': patch
3+
---
4+
5+
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.

packages/core-components/api-report-alpha.md

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { TranslationRef } from '@backstage/core-plugin-api/alpha';
99
export const coreComponentsTranslationRef: TranslationRef<
1010
'core-components',
1111
{
12-
readonly 'link.openNewWindow': 'Opens in a new window';
1312
readonly 'table.filter.title': 'Filters';
1413
readonly 'table.filter.clearAll': 'Clear all';
1514
readonly 'signIn.title': 'Sign In';

packages/core-components/src/components/Link/Link.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* limitations under the License.
1515
*/
1616
import { configApiRef, useAnalytics, useApi } from '@backstage/core-plugin-api';
17-
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
1817
// eslint-disable-next-line no-restricted-imports
1918
import MaterialLink, {
2019
LinkProps as MaterialLinkProps,
@@ -30,7 +29,6 @@ import {
3029
LinkProps as RouterLinkProps,
3130
Route,
3231
} from 'react-router-dom';
33-
import { coreComponentsTranslationRef } from '../../translation';
3432

3533
export function isReactRouterBeta(): boolean {
3634
const [obj] = createRoutesFromChildren(<Route index element={<div />} />);
@@ -163,7 +161,6 @@ export const Link = React.forwardRef<any, LinkProps>(
163161
({ onClick, noTrack, ...props }, ref) => {
164162
const classes = useStyles();
165163
const analytics = useAnalytics();
166-
const { t } = useTranslationRef(coreComponentsTranslationRef);
167164

168165
// Adding the base path to URLs breaks react-router v6 stable, so we only
169166
// 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>(
202199
>
203200
{props.children}
204201
<Typography component="span" className={classes.visuallyHidden}>
205-
{`, ${t('link.openNewWindow')}`}
202+
, Opens in a new window
206203
</Typography>
207204
</MaterialLink>
208205
) : (

packages/core-components/src/translation.ts

-3
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ export const coreComponentsTranslationRef = createTranslationRef({
8080
login: 'Log in',
8181
rejectAll: 'Reject All',
8282
},
83-
link: {
84-
openNewWindow: 'Opens in a new window',
85-
},
8683
supportButton: {
8784
title: 'Support',
8885
close: 'Close',

0 commit comments

Comments
 (0)