diff --git a/src/frontend/apps/impress/src/components/ErrorPage.tsx b/src/frontend/apps/impress/src/components/ErrorPage.tsx index e3c789448..9e013ad6a 100644 --- a/src/frontend/apps/impress/src/components/ErrorPage.tsx +++ b/src/frontend/apps/impress/src/components/ErrorPage.tsx @@ -47,18 +47,23 @@ export const ErrorPage = ({ }: ErrorPageProps) => { const { t } = useTranslation(); - const errorTitle = t('An unexpected error occurred.'); + const errorTitle = t('An unexpected error occurred.', { + description: 'Generic error page title and message', + }); const safeTarget = getSafeRefreshUrl(refreshTarget); return ( <> - {errorTitle} - {t('Docs')} + {errorTitle} -{' '} + {t('Docs', { + description: 'Product name, shown in page titles and the logo', + })} @@ -69,7 +74,10 @@ export const ErrorPage = ({ $padding={{ bottom: '2rem' }} > - {errorTitle} - {t('Docs')} + {errorTitle} -{' '} + {t('Docs', { + description: 'Product name, shown in page titles and the logo', + })} } > - {t('Home')} + {t('Home', { + description: 'Button/link label to go back to the home page', + })} @@ -125,7 +135,9 @@ export const ErrorPage = ({ : window.location.reload() } > - {t('Refresh page')} + {t('Refresh page', { + description: 'Button on the error page to reload the page', + })} )} diff --git a/src/frontend/apps/impress/src/components/InfiniteScroll.tsx b/src/frontend/apps/impress/src/components/InfiniteScroll.tsx index 9b47a1c6b..7b81ed5f3 100644 --- a/src/frontend/apps/impress/src/components/InfiniteScroll.tsx +++ b/src/frontend/apps/impress/src/components/InfiniteScroll.tsx @@ -43,7 +43,10 @@ export const InfiniteScroll = ({ variant="bordered" icon={} > - {buttonLabel ?? t('Load more')} + {buttonLabel ?? + t('Load more', { + description: 'Button to load the next items of a list', + })} )} diff --git a/src/frontend/apps/impress/src/components/Loading.tsx b/src/frontend/apps/impress/src/components/Loading.tsx index 50b1229ae..699e22970 100644 --- a/src/frontend/apps/impress/src/components/Loading.tsx +++ b/src/frontend/apps/impress/src/components/Loading.tsx @@ -30,7 +30,9 @@ export const LoadMoreText = ({ $size="md" /> - {t('Load more')} + {t('Load more', { + description: 'Button to load the next items of a list', + })} ); diff --git a/src/frontend/apps/impress/src/components/SkipToContent.tsx b/src/frontend/apps/impress/src/components/SkipToContent.tsx index 96fab2ada..d08026af4 100644 --- a/src/frontend/apps/impress/src/components/SkipToContent.tsx +++ b/src/frontend/apps/impress/src/components/SkipToContent.tsx @@ -76,7 +76,10 @@ export const SkipToContent = () => { whiteSpace: 'nowrap', }} > - {t('Go to content')} + {t('Go to content', { + description: + 'Skip link for keyboard users to jump to the main content', + })} ); diff --git a/src/frontend/apps/impress/src/components/TextErrors.tsx b/src/frontend/apps/impress/src/components/TextErrors.tsx index 60372c8a8..0c54071dd 100644 --- a/src/frontend/apps/impress/src/components/TextErrors.tsx +++ b/src/frontend/apps/impress/src/components/TextErrors.tsx @@ -64,7 +64,10 @@ export const TextOnlyErrors = ({ {!causes && ( - {defaultMessage || t('Something bad happens, please retry.')} + {defaultMessage || + t('Something bad happens, please retry.', { + description: 'Generic error message shown when a request fails', + })} )} diff --git a/src/frontend/apps/impress/src/components/Title.tsx b/src/frontend/apps/impress/src/components/Title.tsx index f6ec1cf69..2a7a8a5a4 100644 --- a/src/frontend/apps/impress/src/components/Title.tsx +++ b/src/frontend/apps/impress/src/components/Title.tsx @@ -25,7 +25,9 @@ export const Title = ({ $color="var(--c--contextuals--content--logo1)" {...props} > - {t('Docs')} + {t('Docs', { + description: 'Product name, shown in page titles and the logo', + })} ); }; diff --git a/src/frontend/apps/impress/src/components/Waffle.tsx b/src/frontend/apps/impress/src/components/Waffle.tsx index 21f68fb47..5cf0459e6 100644 --- a/src/frontend/apps/impress/src/components/Waffle.tsx +++ b/src/frontend/apps/impress/src/components/Waffle.tsx @@ -131,8 +131,14 @@ export const Waffle = () => { > ); diff --git a/src/frontend/apps/impress/src/components/modal/AlertModal.tsx b/src/frontend/apps/impress/src/components/modal/AlertModal.tsx index 4917ed828..3735fda5a 100644 --- a/src/frontend/apps/impress/src/components/modal/AlertModal.tsx +++ b/src/frontend/apps/impress/src/components/modal/AlertModal.tsx @@ -56,20 +56,27 @@ export const AlertModal = ({ rightActions={ } diff --git a/src/frontend/apps/impress/src/components/quick-search/QuickSearchInput.tsx b/src/frontend/apps/impress/src/components/quick-search/QuickSearchInput.tsx index c8947e39b..814ac6885 100644 --- a/src/frontend/apps/impress/src/components/quick-search/QuickSearchInput.tsx +++ b/src/frontend/apps/impress/src/components/quick-search/QuickSearchInput.tsx @@ -56,7 +56,10 @@ export const QuickSearchInput = ({ autoFocus={true} aria-controls={listId} value={inputValue} - placeholder={placeholder ?? t('Search')} + placeholder={ + placeholder ?? + t('Search', { description: 'Placeholder of a search input' }) + } onValueChange={onFilter} maxLength={254} data-testid="quick-search-input" diff --git a/src/frontend/apps/impress/src/features/auth/components/ButtonLogin.tsx b/src/frontend/apps/impress/src/features/auth/components/ButtonLogin.tsx index fd1299663..d72b585ec 100644 --- a/src/frontend/apps/impress/src/features/auth/components/ButtonLogin.tsx +++ b/src/frontend/apps/impress/src/features/auth/components/ButtonLogin.tsx @@ -33,7 +33,7 @@ export const ButtonLogin = ({ {...props} href={href} > - {children ?? t('Sign in')} + {children ?? t('Sign in', { description: 'Button to log in' })} ); }; @@ -44,7 +44,10 @@ export const ProConnectButton = () => { return ( gotoLogin()} - aria-label={t('Proconnect Login')} + aria-label={t('Proconnect Login', { + description: + 'Accessible name of the ProConnect (French government SSO) login button', + })} $css={css` background-color: var( --c--contextuals--background--semantic--brand--primary diff --git a/src/frontend/apps/impress/src/features/auth/components/UserReconciliation.tsx b/src/frontend/apps/impress/src/features/auth/components/UserReconciliation.tsx index 3c0b2c424..3a248ed72 100644 --- a/src/frontend/apps/impress/src/features/auth/components/UserReconciliation.tsx +++ b/src/frontend/apps/impress/src/features/auth/components/UserReconciliation.tsx @@ -55,8 +55,14 @@ export const UserReconciliation = ({ $variation="primary" > {isError - ? t('An error occurred during email validation.') - : t('Email Address Confirmed')} + ? t('An error occurred during email validation.', { + description: + 'Title shown when the email confirmation of an account merge fails', + }) + : t('Email Address Confirmed', { + description: + 'Title shown after an email address is confirmed during an account merge', + })} {!isError && ( {t( 'To complete the unification of your user accounts, please click the confirmation links sent to all the email addresses you provided.', + { description: 'Instruction of the account merge page' }, )} )} diff --git a/src/frontend/apps/impress/src/features/docs/doc-comments/components/CommentSideBar.tsx b/src/frontend/apps/impress/src/features/docs/doc-comments/components/CommentSideBar.tsx index e1174e9f4..3a3f3fe63 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-comments/components/CommentSideBar.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-comments/components/CommentSideBar.tsx @@ -56,18 +56,26 @@ export const CommentSideBar = ({ onClose }: CommentSideBarProps) => { - {t('Comments')} + {t('Comments', { + description: 'Title of the comments side panel', + })} setFilter('open'), isChecked: filter === 'open', }, { - label: t('Resolved'), + label: t('Resolved', { + description: + 'Dropdown menu item to filter the comments sidebar to only show resolved comment threads.', + }), callback: () => setFilter('resolved'), isChecked: filter === 'resolved', }, @@ -76,9 +84,18 @@ export const CommentSideBar = ({ onClose }: CommentSideBarProps) => { shouldCloseOnInteractOutside={() => true} onOpenChange={setOpen} > - + ); } diff --git a/src/frontend/apps/impress/src/features/docs/doc-editor/components/AI/AIToolbarButton.tsx b/src/frontend/apps/impress/src/features/docs/doc-editor/components/AI/AIToolbarButton.tsx index 4216ac5b5..c2cc24c42 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-editor/components/AI/AIToolbarButton.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-editor/components/AI/AIToolbarButton.tsx @@ -92,7 +92,9 @@ export const AIToolbarButton = () => { $padding={{ right: '2xs' }} > - {t('Ask AI')} + {t('Ask AI', { + description: 'Editor toolbar button opening the AI prompt', + })} { const aiExtension = useAI?.(doc.id, aiBlockNoteAllowed); const collabName = user?.full_name || user?.email; - const cursorName = collabName || t('Anonymous'); + const cursorName = + collabName || + t('Anonymous', { + description: 'Display name of a user without a known name', + }); const showCursorLabels: 'always' | 'activity' | (string & {}) = 'activity'; // Comments @@ -363,7 +367,9 @@ export const BlockNoteEditor = ({ doc, provider }: BlockNoteEditorProps) => { sideMenu={false} theme="light" comments={false} - aria-label={t('Document editor')} + aria-label={t('Document editor', { + description: 'Accessible name of the editor area', + })} // To not clipped the floating part in the editor area portalElements={{ default: null }} > diff --git a/src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteToolBar/MarkdownButton.tsx b/src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteToolBar/MarkdownButton.tsx index 4c08595bd..7689e85f5 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteToolBar/MarkdownButton.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteToolBar/MarkdownButton.tsx @@ -82,7 +82,10 @@ export function MarkdownButton() { return ( onClose()} - aria-label={t('Warning')} + aria-label={t('Warning', { description: 'Title of a warning dialog' })} rightActions={ <> } @@ -57,7 +66,7 @@ export const ModalConfirmDownloadUnsafe = ({ $margin="0" > - {t('Warning')} + {t('Warning', { description: 'Title of a warning dialog' })} } > @@ -65,10 +74,16 @@ export const ModalConfirmDownloadUnsafe = ({ - {t('This file is flagged as unsafe.')} + {t('This file is flagged as unsafe.', { + description: + 'Warning shown before downloading a file detected as malicious', + })} - {t('Please download it only if it comes from a trusted source.')} + {t('Please download it only if it comes from a trusted source.', { + description: + 'Advice shown before downloading a file flagged as unsafe', + })} diff --git a/src/frontend/apps/impress/src/features/docs/doc-editor/components/DocsSideMenu/LinkToBlockItem.tsx b/src/frontend/apps/impress/src/features/docs/doc-editor/components/DocsSideMenu/LinkToBlockItem.tsx index cc5defd27..685a1ce34 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-editor/components/DocsSideMenu/LinkToBlockItem.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-editor/components/DocsSideMenu/LinkToBlockItem.tsx @@ -32,8 +32,12 @@ export const LinkToBlockItem = () => { copyToClipboard( `${window.location.origin}${window.location.pathname}#${block.id}`, - t('Link Copied !'), - t('Failed to copy link'), + t('Link Copied !', { + description: 'Toast confirming a link was copied to the clipboard', + }), + t('Failed to copy link', { + description: 'Toast shown when copying a link failed', + }), ); if (!isMobile) { @@ -54,7 +58,10 @@ export const LinkToBlockItem = () => { > ); diff --git a/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-blocks/CalloutBlock.tsx b/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-blocks/CalloutBlock.tsx index 74c00457e..869bd731f 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-blocks/CalloutBlock.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-blocks/CalloutBlock.tsx @@ -207,7 +207,10 @@ export const getCalloutReactSlashMenuItems = ( ) => [ { key: 'callout', - title: t('Callout'), + title: t('Callout', { + description: + 'Name of the editor block type: a highlighted box with an emoji', + }), onItemClick: () => { insertOrUpdateBlockForSlashMenu(editor, { type: 'callout', @@ -216,14 +219,19 @@ export const getCalloutReactSlashMenuItems = ( aliases: ['callout', 'encadré', 'hervorhebung', 'benadrukken'], group, icon: , - subtext: t('Add a callout block'), + subtext: t('Add a callout block', { + description: 'Description of the callout block in the editor slash menu', + }), }, ]; export const getCalloutFormattingToolbarItems = ( t: TFunction<'translation', undefined>, ): BlockTypeSelectItem => ({ - name: t('Callout'), + name: t('Callout', { + description: + 'Name of the editor block type: a highlighted box with an emoji', + }), type: 'callout', icon: () => , }); diff --git a/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-blocks/PdfBlock.tsx b/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-blocks/PdfBlock.tsx index 596a44b16..dc9bb1816 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-blocks/PdfBlock.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-blocks/PdfBlock.tsx @@ -74,15 +74,21 @@ const PdfBlockComponent = ({ editor, block }: PdfBlockComponentProps) => { useEffect(() => { if (lang && locales[lang as keyof typeof locales]) { locales[lang as keyof typeof locales].file_blocks.add_button_text['pdf'] = - t('Add PDF'); + t('Add PDF', { + description: 'Button label to add a PDF file in the editor', + }); ( locales[lang as keyof typeof locales].file_panel.embed .embed_button as Record - )['pdf'] = t('Add PDF'); + )['pdf'] = t('Add PDF', { + description: 'Button label to add a PDF file in the editor', + }); ( locales[lang as keyof typeof locales].file_panel.upload .file_placeholder as Record - )['pdf'] = t('Upload PDF'); + )['pdf'] = t('Upload PDF', { + description: 'Placeholder text of the PDF block upload area', + }); } }, [lang, t]); @@ -129,7 +135,10 @@ const PdfBlockComponent = ({ editor, block }: PdfBlockComponentProps) => { draggable={false} > - {t('Invalid or missing PDF file.')} + {t('Invalid or missing PDF file.', { + description: + 'Error shown in the PDF block when the file cannot be displayed', + })} ); } @@ -153,7 +162,12 @@ const PdfBlockComponent = ({ editor, block }: PdfBlockComponentProps) => { $width="100%" $height="450px" src={pdfUrl} - aria-label={block.props.name || t('PDF document')} + aria-label={ + block.props.name || + t('PDF document', { + description: 'Accessible name of an embedded PDF', + }) + } contentEditable={false} draggable={false} /> @@ -191,13 +205,34 @@ export const getPdfReactSlashMenuItems = ( group: string, ) => [ { - title: t('PDF'), + title: t('PDF', { + description: 'Name of the PDF file format / editor block', + }), onItemClick: () => { insertOrUpdateBlockForSlashMenu(editor, { type: 'pdf' }); }, - aliases: [t('pdf'), t('document'), t('embed'), t('file')], + aliases: [ + t('pdf', { + description: + 'Search keyword for the PDF block in the editor slash menu', + }), + t('document', { + description: + 'Search keyword for the PDF block in the editor slash menu', + }), + t('embed', { + description: + 'Search keyword for the PDF block in the editor slash menu', + }), + t('file', { + description: + 'Search keyword for the PDF block in the editor slash menu', + }), + ], group, icon: , - subtext: t('Embed a PDF file'), + subtext: t('Embed a PDF file', { + description: 'Description of the PDF block in the editor slash menu', + }), }, ]; diff --git a/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-blocks/UploadLoaderBlock.tsx b/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-blocks/UploadLoaderBlock.tsx index 019a2af88..f477d50fc 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-blocks/UploadLoaderBlock.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-blocks/UploadLoaderBlock.tsx @@ -121,6 +121,10 @@ const UploadLoaderBlockComponent = ({ type: 'warning', information: t( 'The antivirus has detected an anomaly in your file.', + { + description: + 'Message shown in the editor when an uploaded file is flagged by the antivirus', + }, ), }, }); diff --git a/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-inline-content/Interlinking/InterlinkingLinkInlineContent.tsx b/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-inline-content/Interlinking/InterlinkingLinkInlineContent.tsx index 9d96099a9..022624f98 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-inline-content/Interlinking/InterlinkingLinkInlineContent.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-inline-content/Interlinking/InterlinkingLinkInlineContent.tsx @@ -117,7 +117,9 @@ export const getInterlinkinghMenuItems = ( ) => [ { key: 'link-doc', - title: t('Link a doc'), + title: t('Link a doc', { + description: 'Editor menu entry to insert a link to another doc', + }), onItemClick: () => { editor.insertInlineContent([ { @@ -131,16 +133,22 @@ export const getInterlinkinghMenuItems = ( aliases: ['interlinking', 'link', 'anchor', 'a'], group, icon: , - subtext: t('Link this doc to another doc'), + subtext: t('Link this doc to another doc', { + description: 'Description of the "Link a doc" editor menu entry', + }), }, { key: 'new-sub-doc', - title: t('New sub-doc'), + title: t('New sub-doc', { + description: 'Action to create a doc nested under the current doc', + }), onItemClick: createPage, aliases: ['new sub-doc'], group, icon: , - subtext: t('Create a new sub-doc'), + subtext: t('Create a new sub-doc', { + description: 'Description of the "New sub-doc" editor menu entry', + }), }, ]; @@ -151,7 +159,15 @@ export const useGetInterlinkingMenuItems = () => { return ( editor: DocsBlockNoteEditor, t: TFunction<'translation', undefined>, - ) => getInterlinkinghMenuItems(editor, t, t('Links'), createChildDoc); + ) => + getInterlinkinghMenuItems( + editor, + t, + t('Links', { + description: 'Group title of the link entries in the editor menu', + }), + createChildDoc, + ); }; const DisableInvalidInterlink = ({ diff --git a/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-inline-content/Interlinking/SearchPage.tsx b/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-inline-content/Interlinking/SearchPage.tsx index ef20e42b5..ebb8e6a41 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-inline-content/Interlinking/SearchPage.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-inline-content/Interlinking/SearchPage.tsx @@ -165,13 +165,19 @@ export const SearchPage = ({ as="input" name="doc-search-input" role="combobox" - aria-label={t('Search for a document')} + aria-label={t('Search for a document', { + description: + 'Accessible name or placeholder of a document search field', + })} aria-expanded={popoverOpened} aria-haspopup="listbox" aria-autocomplete="list" aria-controls={dropdownId} $padding={{ left: '3px' }} - placeholder={t('mention a sub-doc...')} + placeholder={t('mention a sub-doc...', { + description: + 'Placeholder of the field to search a doc to link in the editor', + })} $css={inputStyle} ref={inputRef} $display="inline-flex" @@ -189,7 +195,10 @@ export const SearchPage = ({ ref={modalRef} id={dropdownId} role="listbox" - aria-label={t('Search results')} + aria-label={t('Search results', { + description: + 'Accessible name or heading of the list of search results', + })} $minWidth={isDesktop ? '330px' : '220px'} $width="fit-content" $zIndex="10" @@ -261,7 +270,10 @@ export const SearchPage = ({ $padding="none" > string, + t: TFunction<'translation', undefined>, ): string | null => { const isMod = event.ctrlKey || event.metaKey; if (!isMod) { @@ -18,11 +19,20 @@ const getFormattingShortcutLabel = ( if (event.altKey) { switch (event.code) { case 'Digit1': - return t('Heading 1 applied'); + return t('Heading 1 applied', { + description: + 'Screen reader announcement after a keyboard shortcut applied a heading level 1', + }); case 'Digit2': - return t('Heading 2 applied'); + return t('Heading 2 applied', { + description: + 'Screen reader announcement after a keyboard shortcut applied a heading level 2', + }); case 'Digit3': - return t('Heading 3 applied'); + return t('Heading 3 applied', { + description: + 'Screen reader announcement after a keyboard shortcut applied a heading level 3', + }); default: return null; } @@ -31,17 +41,35 @@ const getFormattingShortcutLabel = ( if (event.shiftKey) { switch (event.code) { case 'Digit0': - return t('Paragraph applied'); + return t('Paragraph applied', { + description: + 'Screen reader announcement after a keyboard shortcut turned a block into a paragraph', + }); case 'Digit6': - return t('Toggle list applied'); + return t('Toggle list applied', { + description: + 'Screen reader announcement after a keyboard shortcut applied a collapsible list', + }); case 'Digit7': - return t('Numbered list applied'); + return t('Numbered list applied', { + description: + 'Screen reader announcement after a keyboard shortcut applied a numbered list', + }); case 'Digit8': - return t('Bulleted list applied'); + return t('Bulleted list applied', { + description: + 'Screen reader announcement after a keyboard shortcut applied a bulleted list', + }); case 'Digit9': - return t('Checklist applied'); + return t('Checklist applied', { + description: + 'Screen reader announcement after a keyboard shortcut applied a checklist', + }); case 'KeyC': - return t('Code block applied'); + return t('Code block applied', { + description: + 'Screen reader announcement after a keyboard shortcut applied a code block', + }); default: return null; } diff --git a/src/frontend/apps/impress/src/features/docs/doc-editor/hook/useUploadFile.tsx b/src/frontend/apps/impress/src/features/docs/doc-editor/hook/useUploadFile.tsx index 9c0fff081..ec2e24b01 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-editor/hook/useUploadFile.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-editor/hook/useUploadFile.tsx @@ -62,6 +62,8 @@ export const useUploadFile = (docId: string) => { t( 'The file "{{fileName}}" is too large. Maximum file size is {{maxFileSize}}.', { + description: + 'Toast shown when an uploaded file exceeds the size limit', fileName: file.name, maxFileSize: formatFileSize(maxFileSize), }, @@ -132,7 +134,10 @@ export const useUploadStatus = (editor: DocsBlockNoteEditor) => { { type: 'uploadLoader', props: { - information: t('Analyzing file...'), + information: t('Analyzing file...', { + description: + 'Placeholder shown while an uploaded file is scanned by the antivirus', + }), type: 'loading', blockUploadName, blockUploadType, diff --git a/src/frontend/apps/impress/src/features/docs/doc-export/components/ModalExport.tsx b/src/frontend/apps/impress/src/features/docs/doc-export/components/ModalExport.tsx index e04be65a7..dfb58bf09 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-export/components/ModalExport.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-export/components/ModalExport.tsx @@ -61,14 +61,21 @@ export const ModalExport = ({ onClose, doc }: ModalExportProps) => { const formatSelect = useMemo(() => { const formatOptions = (exportAGPL?.formats || []).concat([ { - label: t('Markdown'), + label: t('Markdown', { + description: 'Name of the Markdown export format', + }), value: 'markdown', - labelDescription: t('.md(zip)'), + labelDescription: t('.md(zip)', { + description: + 'File extension hint of the Markdown export, a zip archive', + }), }, { - label: t('HTML'), + label: t('HTML', { description: 'Name of the HTML export format' }), value: 'html', - labelDescription: t('.html(zip)'), + labelDescription: t('.html(zip)', { + description: 'File extension hint of the HTML export, a zip archive', + }), }, ]); @@ -92,7 +99,12 @@ export const ModalExport = ({ onClose, doc }: ModalExportProps) => { /** Exports the selected format and always releases the loading state. */ async function onSubmit() { if (!editor) { - toast(t('The export failed'), VariantType.ERROR); + toast( + t('The export failed', { + description: 'Toast shown when exporting the document fails', + }), + VariantType.ERROR, + ); return; } @@ -169,7 +181,12 @@ export const ModalExport = ({ onClose, doc }: ModalExportProps) => { } if (!blobExport) { - toast(t('The export failed'), VariantType.ERROR); + toast( + t('The export failed', { + description: 'Toast shown when exporting the document fails', + }), + VariantType.ERROR, + ); return; } @@ -177,6 +194,8 @@ export const ModalExport = ({ onClose, doc }: ModalExportProps) => { toast( t('Your {{format}} was downloaded succesfully', { + description: + 'Toast shown after an export; format is PDF, Docx, ODT...', format, }), VariantType.SUCCESS, @@ -184,7 +203,12 @@ export const ModalExport = ({ onClose, doc }: ModalExportProps) => { shouldClose = true; } catch { - toast(t('The export failed'), VariantType.ERROR); + toast( + t('The export failed', { + description: 'Toast shown when exporting the document fails', + }), + VariantType.ERROR, + ); } finally { setIsExporting(false); } @@ -206,16 +230,23 @@ export const ModalExport = ({ onClose, doc }: ModalExportProps) => { rightActions={ <> } @@ -238,11 +271,16 @@ export const ModalExport = ({ onClose, doc }: ModalExportProps) => { $align="flex-start" data-testid="modal-export-title" > - {t('Export')} + {t('Export', { + description: 'Title of the dialog to export a document', + })} onClose()} disabled={isExporting} /> @@ -262,6 +300,7 @@ export const ModalExport = ({ onClose, doc }: ModalExportProps) => { id="modal-export-description" > {t('Export your document to download in {{format}} format.', { + description: 'Explanation in the export dialog', format: formatSelect.allFormatsLabel, })} @@ -269,7 +308,9 @@ export const ModalExport = ({ onClose, doc }: ModalExportProps) => {