{/* The
here is a workaround for the Tooltip which does not work for a "disabled" child */}
-
+
diff --git a/plugins/notifications/src/components/NotificationsTable/NotificationsTable.tsx b/plugins/notifications/src/components/NotificationsTable/NotificationsTable.tsx
index 952c18f9f9..7bedde5f1b 100644
--- a/plugins/notifications/src/components/NotificationsTable/NotificationsTable.tsx
+++ b/plugins/notifications/src/components/NotificationsTable/NotificationsTable.tsx
@@ -32,6 +32,8 @@ import {
TableColumn,
TableProps,
} from '@backstage/core-components';
+import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
+import { notificationsTranslationRef } from '../../translation';
import { notificationsApiRef } from '../../api';
import { SelectAll } from './SelectAll';
@@ -86,6 +88,7 @@ export const NotificationsTable = ({
pageSize,
totalCount,
}: NotificationsTableProps) => {
+ const { t } = useTranslationRef(notificationsTranslationRef);
const classes = useStyles();
const notificationsApi = useApi(notificationsApiRef);
const alertApi = useApi(alertApiRef);
@@ -341,6 +344,19 @@ export const NotificationsTable = ({
onSearchChange={throttledContainsTextHandler}
data={notifications}
columns={compactColumns}
+ localization={{
+ body: {
+ emptyDataSourceMessage: t('table.emptyMessage'),
+ },
+ pagination: {
+ firstTooltip: t('table.pagination.firstTooltip'),
+ labelDisplayedRows: t('table.pagination.labelDisplayedRows'),
+ labelRowsSelect: t('table.pagination.labelRowsSelect'),
+ lastTooltip: t('table.pagination.lastTooltip'),
+ nextTooltip: t('table.pagination.nextTooltip'),
+ previousTooltip: t('table.pagination.previousTooltip'),
+ },
+ }}
/>
);
};
diff --git a/plugins/notifications/src/components/UserNotificationSettingsCard/UserNotificationSettingsCard.tsx b/plugins/notifications/src/components/UserNotificationSettingsCard/UserNotificationSettingsCard.tsx
index fbf7fafc28..e4d85b5748 100644
--- a/plugins/notifications/src/components/UserNotificationSettingsCard/UserNotificationSettingsCard.tsx
+++ b/plugins/notifications/src/components/UserNotificationSettingsCard/UserNotificationSettingsCard.tsx
@@ -20,6 +20,8 @@ import { useNotificationsApi } from '../../hooks';
import { NotificationSettings } from '@backstage/plugin-notifications-common';
import { notificationsApiRef } from '../../api';
import { useApi } from '@backstage/core-plugin-api';
+import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
+import { notificationsTranslationRef } from '../../translation';
import { UserNotificationSettingsPanel } from './UserNotificationSettingsPanel';
import { capitalize } from 'lodash';
@@ -33,11 +35,9 @@ const NotificationFormatContext = createContext
(
);
export const useNotificationFormat = () => {
+ const { t } = useTranslationRef(notificationsTranslationRef);
const context = useContext(NotificationFormatContext);
- if (!context)
- throw new Error(
- 'useNotificationFormat must be used within a NotificationFormatProvider',
- );
+ if (!context) throw new Error(t('settings.errors.useNotificationFormat'));
return context;
};
@@ -83,6 +83,7 @@ export const UserNotificationSettingsCard = (props: {
originNames?: Record;
topicNames?: Record;
}) => {
+ const { t } = useTranslationRef(notificationsTranslationRef);
const [settings, setNotificationSettings] = useState<
NotificationSettings | undefined
>(undefined);
@@ -105,9 +106,9 @@ export const UserNotificationSettingsCard = (props: {
};
return (
-
+
{loading && }
- {error && }
+ {error && }
{settings && (
{
- it('renders each origin only once even if present in multiple channels', () => {
+ it('renders each origin only once even if present in multiple channels', async () => {
const settings = {
channels: [
{
@@ -43,7 +44,7 @@ describe('UserNotificationSettingsPanel', () => {
},
],
};
- render(
+ await renderInTestApp(
all notifications as read.',
+ markAllReadConfirmation: 'Mark All',
+ },
+ errors: {
+ markAllReadFailed: 'Failed to mark all notifications as read',
+ },
+ },
+ sidebar: {
+ title: 'Notifications',
+ errors: {
+ markAsReadFailed: 'Failed to mark notification as read',
+ fetchNotificationFailed: 'Failed to fetch notification',
+ },
+ },
+ settings: {
+ title: 'Notification settings',
+ errorTitle: 'Failed to load settings',
+ noSettingsAvailable:
+ 'No notification settings available, check back later',
+ table: {
+ origin: 'Origin',
+ topic: 'Topic',
+ },
+ errors: {
+ useNotificationFormat:
+ 'useNotificationFormat must be used within a NotificationFormatProvider',
+ },
+ },
+ },
+});