Skip to content

Commit

Permalink
feat(DownloadFiles): add translations
Browse files Browse the repository at this point in the history
  • Loading branch information
MellyGray committed Oct 26, 2023
1 parent a5b6b1f commit ecae5f7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
7 changes: 7 additions & 0 deletions public/locales/en/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@
"provenance": "Provenance",
"delete": "Delete"
}
},
"downloadFiles": {
"title": "Download",
"options": {
"original": "Original Format",
"archival": "Archival Format (.tab)"
}
}
},
"requestAccess": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import { useDataset } from '../../../../DatasetContext'
import { Button, DropdownButton, DropdownButtonItem } from '@iqss/dataverse-design-system'
import { Download } from 'react-bootstrap-icons'
import styles from './DownloadFilesButton.module.scss'
import { useTranslation } from 'react-i18next'

interface DownloadFilesButtonProps {
files: File[]
}

const MINIMUM_FILES_COUNT_TO_SHOW_DOWNLOAD_FILES_BUTTON = 1
export function DownloadFilesButton({ files }: DownloadFilesButtonProps) {
const { t } = useTranslation('files')
const { dataset } = useDataset()

if (
Expand All @@ -24,18 +26,18 @@ export function DownloadFilesButton({ files }: DownloadFilesButtonProps) {
<DropdownButton
id="download-files"
icon={<Download className={styles.icon} />}
title="Download"
title={t('actions.downloadFiles.title')}
variant="secondary"
withSpacing>
<DropdownButtonItem>Original Format</DropdownButtonItem>
<DropdownButtonItem>Archival Format (.tab)</DropdownButtonItem>
<DropdownButtonItem>{t('actions.downloadFiles.options.original')}</DropdownButtonItem>
<DropdownButtonItem>{t('actions.downloadFiles.options.archival')}</DropdownButtonItem>
</DropdownButton>
)
}

return (
<Button variant="secondary" icon={<Download className={styles.icon} />} withSpacing>
Download
{t('actions.downloadFiles.title')}
</Button>
)
}

0 comments on commit ecae5f7

Please sign in to comment.