Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intl/a11y: translate label for toasts area #421

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/components/Toasts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,29 @@ export default function Toasts() {
}
}, [dispatch, alerts]);

// The default hotkey. Explicitly defining so we can use it as a parameter
// for internationalization.
const hotkeyProp = ['F8'];
const hotkeyDisplay = 'F8';

return (
<>
<ToastPrimitive.Viewport
className="bg-transparent pointer-events-none z-30
list-none px-0 pt-0 pb-8 flex flex-col
fixed bottom-0 inset-x-0 box-content content-end items-center"
hotkey={hotkeyProp}
label={intl.formatMessage(
{
defaultMessage: 'Notifications ({hotkey})',
description:
'label for notifications area. The hotkey is a key such as ' +
'F8 that can be pressed on a keyboard to jump to this area.',
},
{
hotkey: hotkeyDisplay,
},
)}
/>
{alerts.map(({ severity, message, id }) => (
<Transition
Expand Down
Loading