Skip to content

Commit

Permalink
fix: get files components texts from locales
Browse files Browse the repository at this point in the history
  • Loading branch information
MellyGray committed Sep 14, 2023
1 parent 406ff9e commit beb948b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
15 changes: 15 additions & 0 deletions public/locales/en/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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."
}
}
}
Original file line number Diff line number Diff line change
@@ -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 (
<Modal show={show} onHide={handleClose} size="lg">
<Modal.Header>
<Modal.Title>Edit File</Modal.Title>
<Modal.Title>{t('actions.alreadyDeletedAlert.title')}</Modal.Title>
</Modal.Header>
<Modal.Body>
<p className={styles.paragraph}>
<ExclamationCircleFill />
This file has already been deleted (or replaced) in the current version. It may not be
edited.
{t('actions.alreadyDeletedAlert.message')}
</p>
</Modal.Body>
<Modal.Footer>
<Button variant="secondary" onClick={handleClose}>
Close
{t('actions.alreadyDeletedAlert.close')}
</Button>
</Modal.Footer>
</Modal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function IngestInfoMessage({ ingest }: IngestInfoMessageProps) {
if (ingest.status === FileIngestStatus.IN_PROGRESS) {
return (
<InfoMessageBox>
<span>Ingest in progress...</span>
<span>{t('ingest.inProgress')}</span>
</InfoMessageBox>
)
}
Expand All @@ -22,18 +22,19 @@ export function IngestInfoMessage({ ingest }: IngestInfoMessageProps) {
return (
<InfoMessageBox>
<span>
File available in original format only{' '}
{t('ingest.error.info')}{' '}
<QuestionMarkTooltip
placement="top"
message={
<p>
<a href="#" title="Tabular Data Files - Dataverse User Guide" target="_blank">
Tabular ingest
<a href="#" title={t('ingest.error.tabularIngestGuide')} target="_blank">
{t('ingest.error.tabularIngest')}
</a>{' '}
was unsuccessful.{' '}
{ingest.reportMessage
? ingest.reportMessage
: 'Ingest failed. No further information is available.'}
? t('ingest.error.reportMessage', {
reportMessage: ingest.reportMessage
})
: t('ingest.error.reportMessageDefault')}
</p>
}
/>
Expand Down

0 comments on commit beb948b

Please sign in to comment.