From beb948b425d09fde9aa704d342edce83f07b8c60 Mon Sep 17 00:00:00 2001 From: MellyGray Date: Thu, 14 Sep 2023 15:54:56 +0200 Subject: [PATCH] fix: get files components texts from locales --- public/locales/en/files.json | 15 +++++++++++++++ .../file-options-menu/FileAlreadyDeletedModal.tsx | 9 +++++---- .../file-info-messages/IngestInfoMessage.tsx | 15 ++++++++------- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/public/locales/en/files.json b/public/locales/en/files.json index 125829fb3..c38b062ac 100644 --- a/public/locales/en/files.json +++ b/public/locales/en/files.json @@ -101,6 +101,11 @@ "editOptions": "Edit Options" } }, + "alreadyDeletedAlert": { + "title": "Edit File", + "message": "This file has already been deleted (or replaced) in the current version. It may not be edited.", + "close": "Close" + }, "accessFileMenu": { "title": "Access File", "headers": { @@ -131,5 +136,15 @@ "embargoedRestricted": "Files are unavailable during the specified embargo and restricted after that", "requestNotAllowed": "Users may not request access to files", "accessRequested": "Access Requested" + }, + "ingest": { + "inProgress": "Ingest in progress...", + "error": { + "info": "File available in original format only", + "tabularIngest": "Tabular ingest", + "tabularIngestGuide": "Tabular Data Files - Dataverse User Guide", + "reportMessage": "was unsuccessful. {{reportMessage}}", + "reportMessageDefault": "was unsuccessful. Ingest failed. No further information is available." + } } } diff --git a/src/sections/dataset/dataset-files/files-table/file-actions/file-actions-cell/file-action-buttons/file-options-menu/FileAlreadyDeletedModal.tsx b/src/sections/dataset/dataset-files/files-table/file-actions/file-actions-cell/file-action-buttons/file-options-menu/FileAlreadyDeletedModal.tsx index 07651d5ed..24d3e0921 100644 --- a/src/sections/dataset/dataset-files/files-table/file-actions/file-actions-cell/file-action-buttons/file-options-menu/FileAlreadyDeletedModal.tsx +++ b/src/sections/dataset/dataset-files/files-table/file-actions/file-actions-cell/file-action-buttons/file-options-menu/FileAlreadyDeletedModal.tsx @@ -1,27 +1,28 @@ import { Button, Modal } from '@iqss/dataverse-design-system' import { ExclamationCircleFill } from 'react-bootstrap-icons' import styles from './FileAlreadyDeletedModal.module.scss' +import { useTranslation } from 'react-i18next' interface FileAlreadyDeletedModalProps { show: boolean handleClose: () => void } export function FileAlreadyDeletedModal({ show, handleClose }: FileAlreadyDeletedModalProps) { + const { t } = useTranslation('files') return ( - Edit File + {t('actions.alreadyDeletedAlert.title')}

- This file has already been deleted (or replaced) in the current version. It may not be - edited. + {t('actions.alreadyDeletedAlert.message')}

diff --git a/src/sections/dataset/dataset-files/files-table/file-actions/file-actions-cell/file-info-messages/IngestInfoMessage.tsx b/src/sections/dataset/dataset-files/files-table/file-actions/file-actions-cell/file-info-messages/IngestInfoMessage.tsx index caf7b8f41..3899b191a 100644 --- a/src/sections/dataset/dataset-files/files-table/file-actions/file-actions-cell/file-info-messages/IngestInfoMessage.tsx +++ b/src/sections/dataset/dataset-files/files-table/file-actions/file-actions-cell/file-info-messages/IngestInfoMessage.tsx @@ -13,7 +13,7 @@ export function IngestInfoMessage({ ingest }: IngestInfoMessageProps) { if (ingest.status === FileIngestStatus.IN_PROGRESS) { return ( - Ingest in progress... + {t('ingest.inProgress')} ) } @@ -22,18 +22,19 @@ export function IngestInfoMessage({ ingest }: IngestInfoMessageProps) { return ( - File available in original format only{' '} + {t('ingest.error.info')}{' '} - - Tabular ingest + + {t('ingest.error.tabularIngest')} {' '} - was unsuccessful.{' '} {ingest.reportMessage - ? ingest.reportMessage - : 'Ingest failed. No further information is available.'} + ? t('ingest.error.reportMessage', { + reportMessage: ingest.reportMessage + }) + : t('ingest.error.reportMessageDefault')}

} />