diff --git a/locales/en/public.json b/locales/en/public.json index 2d7c2e38b..ffddddda1 100644 --- a/locales/en/public.json +++ b/locales/en/public.json @@ -274,6 +274,10 @@ "TITLE": "Quick Starts" } }, + "RecordingLabelFields": { + "INVALID_UPLOADS_one": "The following file did not contain valid recording metadata:", + "INVALID_UPLOADS_other": "The following files did not contain valid recording metadata:" + }, "SETTINGS": { "AUTO_REFRESH": { "CHECKBOX_LABEL": "Enabled", diff --git a/src/app/Archives/ArchiveUploadModal.tsx b/src/app/Archives/ArchiveUploadModal.tsx index 91c410e81..163c3c220 100644 --- a/src/app/Archives/ArchiveUploadModal.tsx +++ b/src/app/Archives/ArchiveUploadModal.tsx @@ -167,7 +167,6 @@ export const ArchiveUploadModal: React.FC = ({ onClose, return ( => value: labelObj[key], }); }); + return labels; } - return labels; + throw new Error('No labels found in file'); }) ); }; diff --git a/src/app/RecordingMetadata/RecordingLabelFields.tsx b/src/app/RecordingMetadata/RecordingLabelFields.tsx index 5fe951d3b..c8fee3c21 100644 --- a/src/app/RecordingMetadata/RecordingLabelFields.tsx +++ b/src/app/RecordingMetadata/RecordingLabelFields.tsx @@ -55,6 +55,7 @@ import { } from '@patternfly/react-core'; import { CloseIcon, ExclamationCircleIcon, FileIcon, PlusCircleIcon, UploadIcon } from '@patternfly/react-icons'; import * as React from 'react'; +import { useTranslation } from 'react-i18next'; import { catchError, Observable, of, zip } from 'rxjs'; export interface RecordingLabelFieldsProps { @@ -82,6 +83,7 @@ export const RecordingLabelFields: React.FunctionComponent { const inputRef = React.useRef(null); // Use ref to refer to child component const addSubscription = useSubscriptions(); + const { t } = useTranslation(); const [loading, setLoading] = React.useState(false); const [invalidUploads, setInvalidUploads] = React.useState([]); @@ -217,9 +219,9 @@ export const RecordingLabelFields: React.FunctionComponent} bodyContent={ <> - {`The following file${ - invalidUploads.length > 1 ? 's' : '' - } did not contain valid recording metadata:`} + + {t('RecordingLabelFields.INVALID_UPLOADS', { count: invalidUploads.length })} + {invalidUploads.map((uploadName) => ( }>