diff --git a/public/locales/en/files.json b/public/locales/en/files.json index 0614e005d..2d849ebe3 100644 --- a/public/locales/en/files.json +++ b/public/locales/en/files.json @@ -14,6 +14,7 @@ "openWithLocalAndPublicGateway": "Try opening it instead with your <1>local gateway or <3>public gateway.", "cantBePreviewed": "Sorry, this file can’t be previewed", "addByPath": "From IPFS", + "bulkImport": "Bulk import", "newFolder": "New folder", "generating": "Generating…", "actions": { @@ -59,6 +60,14 @@ "namePlaceholder": "Name (optional)", "examples": "Examples:" }, + "bulkImportModal": { + "title": "Bulk import with text file", + "description": "Upload a text file with a list of CIDs (names are optional). Example:", + "select": "Select file", + "selectedFile": "Selected file:", + "invalidCids": "*Invalid CID(s) found", + "failedToReadFile": "*Failed to read file contents" + }, "newFolderModal": { "title": "New folder", "description": "Insert the name of the folder you want to create." diff --git a/src/files/file-input/FileInput.js b/src/files/file-input/FileInput.js index d67b2b58c..f56e55c8f 100644 --- a/src/files/file-input/FileInput.js +++ b/src/files/file-input/FileInput.js @@ -105,7 +105,7 @@ class FileInput extends React.Component { // isCliTutorModeEnabled={isCliTutorModeEnabled} > - Bulk CID Import + {t('bulkImport')} diff --git a/src/files/modals/bulk-import-modal/BulkImportModal.js b/src/files/modals/bulk-import-modal/BulkImportModal.js index 25dc03172..edb94d797 100644 --- a/src/files/modals/bulk-import-modal/BulkImportModal.js +++ b/src/files/modals/bulk-import-modal/BulkImportModal.js @@ -31,13 +31,13 @@ class BulkImportModal extends React.Component { for (const line of lines) { const [cid] = line.trim().split(' ') if (!isIPFS.cid(cid)) { - return { isValid: false, error: '*Invalid CID(s) found' } + return { isValid: false, error: this.props.t('bulkImportModal.invalidCids') } } } return { isValid: true } } catch (err) { - return { isValid: false, error: '*Failed to read file contents' } + return { isValid: false, error: this.props.t('bulkImportModal.failedToReadFile') } } } @@ -53,7 +53,7 @@ class BulkImportModal extends React.Component { } selectFile = async () => { - return this.bulkCidInputt.click() + return this.bulkCidInput.click() } onSubmit = async () => { @@ -76,9 +76,9 @@ class BulkImportModal extends React.Component { return ( - +
-

{'Upload a text file with a list of CIDs (names are optional).' + ' ' + 'Example:'}

+

{t('bulkImportModal.description')}

bafkreibm6jg3ux5qumhcn2b3flc3tyu6dmlb4xa7u5bf44yegnrjhc4yeq
QmawceGscqN4o8Y8Fv26UUmB454kn2bnkXV5tEQYc4jBd6 barrel.png
QmbvrHYWXAU1BuxMPNRtfeF4DS2oPmo5hat7ocqAkNPr74 pi equals.png
@@ -90,10 +90,7 @@ class BulkImportModal extends React.Component { onChange={this.onChange} // className='input-reset' // id='bulk-import' - ref={el => { - console.log('Setting ref:', el) - this.bulkCidInputt = el - }} + ref={el => { this.bulkCidInput = el }} /> {this.state.selectedFile && (

- Selected file: {this.state.selectedFile.name} + {`${t('bulkImportModal.selectedFile')}: ${this.state.selectedFile.name}`}

)}