diff --git a/Makefile b/Makefile index c614da9d7bb..ddf5da40285 100755 --- a/Makefile +++ b/Makefile @@ -93,6 +93,8 @@ locales: msgfmt -o modules/dqt/locale/ja/LC_MESSAGES/dqt.mo modules/dqt/locale/ja/LC_MESSAGES/dqt.po msgfmt -o modules/electrophysiology_browser/locale/ja/LC_MESSAGES/electrophysiology_browser.mo modules/electrophysiology_browser/locale/ja/LC_MESSAGES/electrophysiology_browser.po msgfmt -o modules/electrophysiology_uploader/locale/ja/LC_MESSAGES/electrophysiology_uploader.mo modules/electrophysiology_uploader/locale/ja/LC_MESSAGES/electrophysiology_uploader.po + msgfmt -o modules/electrophysiology_uploader/locale/hi/LC_MESSAGES/electrophysiology_uploader.mo modules/electrophysiology_uploader/locale/hi/LC_MESSAGES/electrophysiology_uploader.po + npx i18next-conv -l hi -s modules/electrophysiology_uploader/locale/hi/LC_MESSAGES/electrophysiology_uploader.po -t modules/electrophysiology_uploader/locale/hi/LC_MESSAGES/electrophysiology_uploader.json msgfmt -o modules/examiner/locale/ja/LC_MESSAGES/examiner.mo modules/examiner/locale/ja/LC_MESSAGES/examiner.po msgfmt -o modules/genomic_browser/locale/ja/LC_MESSAGES/genomic_browser.mo modules/genomic_browser/locale/ja/LC_MESSAGES/genomic_browser.po msgfmt -o modules/help_editor/locale/ja/LC_MESSAGES/help_editor.mo modules/help_editor/locale/ja/LC_MESSAGES/help_editor.po diff --git a/modules/electrophysiology_uploader/jsx/ElectrophysiologyUploader.js b/modules/electrophysiology_uploader/jsx/ElectrophysiologyUploader.js index d299f644bfd..b4cd37129da 100644 --- a/modules/electrophysiology_uploader/jsx/ElectrophysiologyUploader.js +++ b/modules/electrophysiology_uploader/jsx/ElectrophysiologyUploader.js @@ -5,6 +5,11 @@ import {TabPane, Tabs} from 'jsx/Tabs'; import UploadForm from './UploadForm'; import UploadViewer from './UploadViewer'; import {createRoot} from 'react-dom/client'; +import i18n from 'I18nSetup'; +import {useTranslation} from 'react-i18next'; + +import hiStrings from + '../locale/hi/LC_MESSAGES/electrophysiology_uploader.json'; /** * UploadViewer @@ -12,7 +17,9 @@ import {createRoot} from 'react-dom/client'; * @param {array} props * @return {JSX} */ -export default function ElectrophysiologyUploader(props) { +function ElectrophysiologyUploader(props) { + const {DataURL} = props; + const {t} = useTranslation(['electrophysiology_uploader', 'loris']); const [isLoaded, setIsLoaded] = useState(false); const [data, setData] = useState({}); @@ -29,7 +36,7 @@ export default function ElectrophysiologyUploader(props) { * for easy access by columnFormatter. */ const fetchData = () => { - fetch(`${props.DataURL}/?format=json`, { + fetch(`${DataURL}/?format=json`, { method: 'GET', }).then((response) => { if (!response.ok) { @@ -56,30 +63,35 @@ export default function ElectrophysiologyUploader(props) { } const tabList = [ - {id: 'browse', label: 'Browse'}, - {id: 'upload', label: 'Upload'}, + {id: 'browse', label: t('Browse', {ns: 'loris'})}, + {id: 'upload', label: t('Upload', {ns: 'loris'})}, ]; return ( <>
- LORIS 26 Beta Note: Files uploaded in this module - will not be viewable in the Electrophysiology Browser - module. This feature is under construction for the next release. - Please get in touch with the LORIS team to configure this for your - project. + {t('LORIS 26 Beta Note:', + {ns: 'electrophysiology_uploader'})} + {t('Files uploaded in this module will not be viewable'+ + ' in the Electrophysiology Browser module. ' + + 'This feature is under construction for the next release. ' + + 'Please get in touch with the LORIS team ' + + 'to configure this for your project.', + {ns: 'electrophysiology_uploader'})}
@@ -89,12 +101,17 @@ export default function ElectrophysiologyUploader(props) { ElectrophysiologyUploader.propTypes = { DataURL: PropTypes.string.isRequired, + t: PropTypes.func, }; /** * Render imaging_uploader on page load */ +export default ElectrophysiologyUploader; + document.addEventListener('DOMContentLoaded', function() { + i18n.addResourceBundle('hi', 'electrophysiology_uploader', hiStrings); + createRoot( document.getElementById('lorisworkspace') ).render( diff --git a/modules/electrophysiology_uploader/jsx/UploadForm.js b/modules/electrophysiology_uploader/jsx/UploadForm.js index a8cbdcb9138..f9316f4b2fe 100644 --- a/modules/electrophysiology_uploader/jsx/UploadForm.js +++ b/modules/electrophysiology_uploader/jsx/UploadForm.js @@ -17,6 +17,7 @@ import { * @return {JSX} */ export default function UploadForm(props) { + const {t} = props; const [formData, setFormData] = useState({}); const [errorMessage, setErrorMessage] = useState({}); const [uploadProgress, setuploadProgress] = useState(-1); @@ -77,14 +78,18 @@ export default function UploadForm(props) { const fileNameConvention = pNameElements.join('_') + '.tar.gz'; if (!fileName.match(properExt)) { swal.fire({ - title: 'Invalid extension for the uploaded file!', - text: 'Filename extension does not match .tar.gz ', + title: t('Invalid extension for the uploaded file!', + {ns: 'electrophysiology_uploader'}), + text: t('Filename extension does not match .tar.gz ', + {ns: 'electrophysiology_uploader'}), type: 'error', - confirmButtonText: 'OK', + confirmButtonText: t('OK', {ns: 'electrophysiology_uploader'}), }); setErrorMessage({ - eegFile: 'The file ' + fileName + ' must be of type .tar.gz.', + eegFile: t('The file', {ns: 'electrophysiology_uploader'}) + + ' ' + fileName + ' ' + t('must be of type .tar.gz.', + {ns: 'electrophysiology_uploader'}), candID: null, pscid: null, visit: null, @@ -95,15 +100,17 @@ export default function UploadForm(props) { if (fileName !== fileNameConvention) { swal.fire({ - title: 'Invalid filename!', - text: 'Filename should be of the form ' - + '[PSCID]_[CandID]_[VisitLabel]_bids.tar.gz', + title: t('Invalid filename!', {ns: 'electrophysiology_uploader'}), + text: t('Filename should be of the form', + {ns: 'electrophysiology_uploader'}) + + ' [PSCID]_[CandID]_[VisitLabel]_bids.tar.gz', type: 'error', - confirmButtonText: 'OK', + confirmButtonText: t('OK', {ns: 'electrophysiology_uploader'}), }); setErrorMessage({ - eegFile: 'The file does not respect name convention', + eegFile: t('The file does not respect name convention', + {ns: 'electrophysiology_uploader'}), candID: null, pscid: null, visit: null, @@ -151,15 +158,17 @@ export default function UploadForm(props) { let text = ''; if (props.autoLaunch === 'true' || props.autoLaunch === '1') { - text = 'Processing of this file by the EEG pipeline has started'; + text = t('Processing of this file by the EEG pipeline has started', + {ns: 'electrophysiology_uploader'}); } swal.fire({ - title: 'Upload Successful!', + title: t('Upload Successful!', + {ns: 'electrophysiology_uploader'}), text: text, type: 'success', }).then((result) => { if (result.value) { - this.props.refreshPage(); + props.refreshPage(); } }); @@ -197,17 +206,20 @@ export default function UploadForm(props) { error = resp.error; } } else if (xhr.status == 0) { - error = 'Upload failed: a network error occured'; + error = t('Upload failed: a network error occured', + {ns: 'electrophysiology_uploader'}); } else if (xhr.status == 413) { - error = 'Please make sure files are not larger than ' - + props.maxUploadSize; + error = t('Please make sure files are not larger than', + {ns: 'electrophysiology_uploader'}) + + ' ' + props.maxUploadSize; } else { - error = 'Upload failed: received HTTP response code ' - + xhr.status; + error = t('Upload failed: received HTTP response code', + {ns: 'electrophysiology_uploader'}) + + ' ' + xhr.status; } swal.fire({ - title: 'Submission error!', + title: t('Submission error!', {ns: 'electrophysiology_uploader'}), text: error, type: 'error', }); @@ -218,7 +230,8 @@ export default function UploadForm(props) { return (
-

Upload an electrophysiology recording session

+

{t('Upload an electrophysiology recording session', + {ns: 'electrophysiology_uploader'})}


{props.maxUploadSize && - `File cannot exceed ${props.maxUploadSize}
x` + t('File cannot exceed', + {ns: 'electrophysiology_uploader'}) + + ` ${props.maxUploadSize}
x` } - File name must match the following convention:
+ {t('File name must match the following convention:', + {ns: 'electrophysiology_uploader'})}
[PSCID]_[CandID]_[Visit Label]_bids.tar.gz } @@ -289,4 +306,6 @@ UploadForm.propTypes = { autoLaunch: PropTypes.string, uploadURL: PropTypes.string.isRequired, maxUploadSize: PropTypes.number, + refreshPage: PropTypes.func, + t: PropTypes.func, }; diff --git a/modules/electrophysiology_uploader/jsx/UploadViewer.js b/modules/electrophysiology_uploader/jsx/UploadViewer.js index 819763e9b17..a098c17456a 100644 --- a/modules/electrophysiology_uploader/jsx/UploadViewer.js +++ b/modules/electrophysiology_uploader/jsx/UploadViewer.js @@ -17,16 +17,19 @@ export default function UploadViewer(props) { * @param {object} row - row content indexed by column * @return {JSX} a formated table cell for a given column */ + const {t} = props; const formatColumn = (column, cell, row) => { switch (column) { - case 'Upload Location': + case t('Upload Location', {ns: 'electrophysiology_uploader'}): const downloadURL = loris.BaseURL + '/electrophysiology_uploader/upload?' + `upload_id=${row['Upload ID']}`; return ( - + {cell} @@ -38,11 +41,11 @@ export default function UploadViewer(props) { const fields = [ { - label: 'Upload ID', + label: t('Upload ID', {ns: 'electrophysiology_uploader'}), show: true, }, { - label: 'Site', + label: t('Site', {ns: 'loris'}), show: true, filter: { name: 'site', @@ -51,7 +54,7 @@ export default function UploadViewer(props) { }, }, { - label: 'PSCID', + label: t('PSCID', {ns: 'loris'}), show: true, filter: { name: 'pscid', @@ -59,7 +62,7 @@ export default function UploadViewer(props) { }, }, { - label: 'Visit', + label: t('Visit Label', {ns: 'loris'}), show: true, filter: { name: 'visitLabel', @@ -68,19 +71,19 @@ export default function UploadViewer(props) { }, }, { - label: 'Upload Location', + label: t('Upload Location', {ns: 'electrophysiology_uploader'}), show: true, }, { - label: 'Upload Time', + label: t('Upload Time', {ns: 'electrophysiology_uploader'}), show: false, }, { - label: 'Status', + label: t('Status', {ns: 'electrophysiology_uploader'}), show: true, }, { - label: 'Uploaded By', + label: t('Uploaded By', {ns: 'electrophysiology_uploader'}), show: true, }, ]; @@ -98,4 +101,5 @@ export default function UploadViewer(props) { UploadViewer.propTypes = { data: PropTypes.array.isRequired, fieldOptions: PropTypes.object.isRequired, + t: PropTypes.func, }; diff --git a/modules/electrophysiology_uploader/locale/electrophysiology_uploader.pot b/modules/electrophysiology_uploader/locale/electrophysiology_uploader.pot index 2c3a77e1f45..c3e94289571 100644 --- a/modules/electrophysiology_uploader/locale/electrophysiology_uploader.pot +++ b/modules/electrophysiology_uploader/locale/electrophysiology_uploader.pot @@ -21,3 +21,81 @@ msgstr "" msgid "Electrophysiology Uploader" msgstr "" +msgid "LORIS 26 Beta Note:" +msgstr "" + +msgid "Files uploaded in this module will not be viewable in the Electrophysiology Browser module. This feature is under construction for the next release. Please get in touch with the LORIS team to configure this for your project." +msgstr "" + +msgid "Upload an electrophysiology recording session" +msgstr "" + +msgid "File to Upload" +msgstr "" + +msgid "Notes" +msgstr "" + +msgid "File cannot exceed" +msgstr "" + +msgid "File name must match the following convention:" +msgstr "" + +msgid "Invalid extension for the uploaded file!" +msgstr "" + +msgid "Filename extension does not match .tar.gz " +msgstr "" + +msgid "OK" +msgstr "" + +msgid "The file" +msgstr "" + +msgid "must be of type .tar.gz." +msgstr "" + +msgid "Invalid filename!" +msgstr "" + +msgid "Filename should be of the form" +msgstr "" + +msgid "The file does not respect name convention" +msgstr "" + +msgid "Upload Successful!" +msgstr "" + +msgid "Processing of this file by the EEG pipeline has started" +msgstr "" + +msgid "Upload failed: a network error occured" +msgstr "" + +msgid "Please make sure files are not larger than" +msgstr "" + +msgid "Upload failed: received HTTP response code" +msgstr "" + +msgid "Submission error!" +msgstr "" + +msgid "Upload Location" +msgstr "" + +msgid "Upload ID" +msgstr "" + +msgid "Upload Time" +msgstr "" + +msgid "Status" +msgstr "" + +msgid "Uploaded By" +msgstr "" + diff --git a/modules/electrophysiology_uploader/locale/hi/LC_MESSAGES/electrophysiology_uploader.po b/modules/electrophysiology_uploader/locale/hi/LC_MESSAGES/electrophysiology_uploader.po new file mode 100644 index 00000000000..3d97773c33b --- /dev/null +++ b/modules/electrophysiology_uploader/locale/hi/LC_MESSAGES/electrophysiology_uploader.po @@ -0,0 +1,101 @@ +# Default LORIS strings to be translated (English). +# Copy this to a language specific file and add translations to the +# new file. +# Copyright (C) 2025 +# This file is distributed under the same license as the LORIS package. +# Dave MacFarlane , 2025. +# +msgid "" +msgstr "" +"Project-Id-Version: LORIS 27\n" +"Report-Msgid-Bugs-To: https://github.com/aces/Loris/issues\n" +"POT-Creation-Date: 2025-04-08 14:37-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: hi\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "Electrophysiology Uploader" +msgstr "इलेक्ट्रोफिजियोलॉजी अपलोडर" + +msgid "LORIS 26 Beta Note:" +msgstr "LORIS 26 बीटा नोट:" + +msgid "Files uploaded in this module will not be viewable in the Electrophysiology Browser module. This feature is under construction for the next release. Please get in touch with the LORIS team to configure this for your project." +msgstr "इस मॉड्यूल में अपलोड की गई फाइलें Electrophysiology Browser मॉड्यूल में दिखाई नहीं देंगी। यह सुविधा अगले संस्करण के लिए निर्माणाधीन है। कृपया अपने प्रोजेक्ट के लिए इसे कॉन्फ़िगर करने हेतु LORIS टीम से संपर्क करें।" + +msgid "Upload an electrophysiology recording session" +msgstr "एक इलेक्ट्रोफिजियोलॉजी रिकॉर्डिंग सत्र अपलोड करें" + +msgid "File to Upload" +msgstr "अपलोड करने के लिए फ़ाइल" + +msgid "Notes" +msgstr "नोट्स" + +msgid "File cannot exceed" +msgstr "फ़ाइल इससे अधिक नहीं हो सकती" + +msgid "File name must match the following convention:" +msgstr "फ़ाइल नाम निम्नलिखित कन्वेंशन से मेल खाना चाहिए:" + +msgid "Invalid extension for the uploaded file!" +msgstr "अपलोड की गई फ़ाइल के लिए एक्सटेंशन अमान्य है!" + +msgid "Filename extension does not match .tar.gz " +msgstr "फ़ाइल नाम एक्सटेंशन .tar.gz से मेल नहीं खाता" + +msgid "OK" +msgstr "ठीक है" + +msgid "The file" +msgstr "फ़ाइल" + +msgid "must be of type .tar.gz." +msgstr "का प्रकार .tar.gz होना चाहिए।" + +msgid "Invalid filename!" +msgstr "अमान्य फ़ाइल नाम!" + +msgid "Filename should be of the form" +msgstr "फ़ाइल नाम इस रूप में होना चाहिए" + +msgid "The file does not respect name convention" +msgstr "फ़ाइल नाम कन्वेंशन का पालन नहीं करता" + +msgid "Upload Successful!" +msgstr "अपलोड सफल!" + +msgid "Processing of this file by the EEG pipeline has started" +msgstr "इस फ़ाइल का EEG पाइपलाइन द्वारा प्रोसेसिंग शुरू हो गई है" + +msgid "Upload failed: a network error occured" +msgstr "अपलोड विफल: नेटवर्क त्रुटि हुई" + +msgid "Please make sure files are not larger than" +msgstr "कृपया सुनिश्चित करें कि फ़ाइलें इससे बड़ी न हों" + +msgid "Upload failed: received HTTP response code" +msgstr "अपलोड विफल: HTTP प्रतिक्रिया कोड प्राप्त हुआ" + +msgid "Submission error!" +msgstr "सबमिशन त्रुटि!" + +msgid "Upload Location" +msgstr "अपलोड स्थान" + +msgid "Upload ID" +msgstr "अपलोड आईडी" + +msgid "Upload Time" +msgstr "अपलोड समय" + +msgid "Status" +msgstr "स्थिति" + +msgid "Uploaded By" +msgstr "द्वारा अपलोड किया गया" +