diff --git a/Makefile b/Makefile index 0eb144d3d70..5ec8617bd72 100755 --- a/Makefile +++ b/Makefile @@ -114,6 +114,8 @@ locales: msgfmt -o modules/imaging_browser/locale/ja/LC_MESSAGES/imaging_browser.mo modules/imaging_browser/locale/ja/LC_MESSAGES/imaging_browser.po msgfmt -o modules/imaging_qc/locale/ja/LC_MESSAGES/imaging_qc.mo modules/imaging_qc/locale/ja/LC_MESSAGES/imaging_qc.po msgfmt -o modules/imaging_uploader/locale/ja/LC_MESSAGES/imaging_uploader.mo modules/imaging_uploader/locale/ja/LC_MESSAGES/imaging_uploader.po + msgfmt -o modules/imaging_uploader/locale/hi/LC_MESSAGES/imaging_uploader.mo modules/imaging_uploader/locale/hi/LC_MESSAGES/imaging_uploader.po + npx i18next-conv -l hi -s modules/imaging_uploader/locale/hi/LC_MESSAGES/imaging_uploader.po -t modules/imaging_uploader/locale/hi/LC_MESSAGES/imaging_uploader.json msgfmt -o modules/instrument_builder/locale/ja/LC_MESSAGES/instrument_builder.mo modules/instrument_builder/locale/ja/LC_MESSAGES/instrument_builder.po msgfmt -o modules/instrument_list/locale/ja/LC_MESSAGES/instrument_list.mo modules/instrument_list/locale/ja/LC_MESSAGES/instrument_list.po msgfmt -o modules/instrument_manager/locale/ja/LC_MESSAGES/instrument_manager.mo modules/instrument_manager/locale/ja/LC_MESSAGES/instrument_manager.po diff --git a/locale/hi/LC_MESSAGES/loris.po b/locale/hi/LC_MESSAGES/loris.po index 32d08fba0ca..dee28d0933d 100644 --- a/locale/hi/LC_MESSAGES/loris.po +++ b/locale/hi/LC_MESSAGES/loris.po @@ -120,6 +120,15 @@ msgstr "हाँ" msgid "No" msgstr "नहीं" +msgid "Browse" +msgstr "ब्राउज़ करें" + +msgid "Upload" +msgstr "अपलोड करें" + +msgid "Clear Filters" +msgstr "फ़िल्टर हटाएँ" + # Common candidate terms msgid "PSCID" msgstr "पीएससीआईडी" @@ -127,6 +136,9 @@ msgstr "पीएससीआईडी" msgid "DCCID" msgstr "डीसीसीआईडी" +msgid "CandID" +msgstr "उम्मीदवार आईडी" + msgid "Visit Label" msgstr "दौरे का लेबल" diff --git a/locale/loris.pot b/locale/loris.pot index 5d0d10f350e..1cd569aefd4 100644 --- a/locale/loris.pot +++ b/locale/loris.pot @@ -119,6 +119,15 @@ msgstr "" msgid "No" msgstr "" +msgid "Clear Filters" +msgstr "" + +msgid "Browse" +msgstr "" + +msgid "Upload" +msgstr "" + # Common swal labels msgid "Cancel" msgstr "" @@ -133,6 +142,9 @@ msgstr "" msgid "DCCID" msgstr "" +msgid "CandID" +msgstr "" + msgid "Visit Label" msgstr "" @@ -220,42 +232,3 @@ msgstr "" msgid "NEW" msgstr "" -msgid "Updated" -msgstr "" - -msgid "Uploaded" -msgstr "" - -msgid "Total" -msgstr "" - -# Common timepoint and vist terms -msgid "Not Started" -msgstr "" - -msgid "Screening" -msgstr "" - -msgid "Visit" -msgstr "" - -msgid "Approval" -msgstr "" - -msgid "Subject" -msgstr "" - -msgid "Recycling Bin" -msgstr "" - -msgid "Pass" -msgstr "" - -msgid "Failure" -msgstr "" - -msgid "Withdrawal" -msgstr "" - -msgid "In Progress" -msgstr "" diff --git a/modules/imaging_uploader/jsx/ImagingUploader.js b/modules/imaging_uploader/jsx/ImagingUploader.js index a698295e320..5c6b0ce3a20 100644 --- a/modules/imaging_uploader/jsx/ImagingUploader.js +++ b/modules/imaging_uploader/jsx/ImagingUploader.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import FilterForm from 'FilterForm'; import {Tabs, TabPane} from 'Tabs'; import Loader from 'Loader'; - +import {withTranslation} from 'react-i18next'; import LogPanel from './LogPanel'; import UploadForm from './UploadForm'; import {TextboxElement, SelectElement, ButtonElement} from 'jsx/Form'; @@ -211,13 +211,14 @@ class ImagingUploader extends Component { * @return {JSX} - React markup for the component */ render() { + const {t} = this.props; if (!this.state.isLoaded) { return ; } 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 ( @@ -238,13 +239,13 @@ class ImagingUploader extends Component {
- +
@@ -265,6 +266,7 @@ class ImagingUploader extends Component { imagingUploaderAutoLaunch={ this.state.data.imagingUploaderAutoLaunch } + t={t} /> @@ -274,6 +276,7 @@ class ImagingUploader extends Component { ImagingUploader.propTypes = { DataURL: PropTypes.string.isRequired, + t: PropTypes.func, }; -export default ImagingUploader; +export default withTranslation(['imaging_uploader', 'loris'])(ImagingUploader); diff --git a/modules/imaging_uploader/jsx/LogPanel.js b/modules/imaging_uploader/jsx/LogPanel.js index 1a6a69349c7..9758bd38351 100644 --- a/modules/imaging_uploader/jsx/LogPanel.js +++ b/modules/imaging_uploader/jsx/LogPanel.js @@ -1,6 +1,8 @@ /* global UploadProgress */ import React, {Component} from 'react'; import Panel from 'Panel'; +import PropTypes from 'prop-types'; +import {withTranslation} from 'react-i18next'; import { FormElement, SelectElement, @@ -198,17 +200,18 @@ class LogPanel extends Component { * @return {JSX} - React markup for the component */ render() { + const {t} = this.props; const logTypes = { - summary: 'Summary', - detailed: 'Detailed', + summary: t('Summary', {ns: 'imaging_uploader'}), + detailed: t('Detailed', {ns: 'imaging_uploader'}), }; return ( - + { if (result.value) { this.uploadFile(true); } else { - swal.fire('Cancelled', 'Your upload has been cancelled.', 'error'); + swal.fire( + t('Cancelled', {ns: 'imaging_uploader'}), + t('Your upload has been cancelled.', + {ns: 'imaging_uploader'}), + 'error' + ); } }); } @@ -230,19 +246,27 @@ class UploadForm extends Component { // Pipeline has not been triggered yet if (mriFile.status === 'Not Started') { swal.fire({ - title: 'Are you sure?', - text: 'A file with this name has been uploaded ' - + 'but has not yet been processed by the MRI pipeline.\n ' - + 'Would you like to overwrite the existing file?', + title: t('Are you sure?', {ns: 'imaging_uploader'}), + text: t('A file with this name has been uploaded but has'+ + ' not yet been processed by the MRI pipeline.' + + ' Would you like to overwrite the existing file?', + {ns: 'imaging_uploader'}), type: 'warning', showCancelButton: true, - confirmButtonText: 'Yes, I am sure!', - cancelButtonText: 'No, cancel it!', + confirmButtonText: t('Yes, I am sure!', + {ns: 'imaging_uploader'}), + cancelButtonText: t('No, cancel it!', + {ns: 'imaging_uploader'}), }).then((result) => { if (result.value) { this.uploadFile(true); } else { - swal.fire('Cancelled', 'Your upload has been cancelled.', 'error'); + swal.fire( + t('Cancelled', {ns: 'imaging_uploader'}), + t('Your upload has been cancelled.', + {ns: 'imaging_uploader'}), + 'error' + ); } }); } @@ -257,6 +281,7 @@ class UploadForm extends Component { * @param {boolean} overwriteFile */ uploadFile(overwriteFile) { + const {t} = this.props; const formData = this.state.formData; let formObj = new FormData(); for (let key in formData) { @@ -294,15 +319,18 @@ class UploadForm extends Component { if (this.props.imagingUploaderAutoLaunch === 'true' || this.props.imagingUploaderAutoLaunch === '1' ) { - text = 'Processing of this file by the MRI pipeline has started\n' - + 'Select this upload in the result table ' - + 'to view the processing progress'; + text = + t('Processing of this file by the MRI pipeline has started', + {ns: 'imaging_uploader'}) + '\n' + + t('Select this upload in the result table'+ + ' to view the processing progress', + {ns: 'imaging_uploader'}); } swal.fire({ - title: 'Upload Successful!', + title: t('Upload Successful!', {ns: 'imaging_uploader'}), text: text, type: 'success', - confirmButtonText: 'OK', + confirmButtonText: t('OK', {ns: 'imaging_uploader'}), }).then((result) => { window.location.assign(loris.BaseURL + '/imaging_uploader/'); }); @@ -325,6 +353,7 @@ class UploadForm extends Component { * @param {XMLHttpRequest} xhr - XMLHttpRequest */ processError(xhr) { + const {t} = this.props; // Upon errors in upload: // - Displays pop up window with submission error message // - Updates errorMessage so relevant errors are displayed on form @@ -341,20 +370,23 @@ class UploadForm extends Component { } } else if (xhr.status == 0) { errorMessage = { - 'mriFile': ['Upload failed: a network error occured'], + 'mriFile': [t('Upload failed: a network error occured', + {ns: 'imaging_uploader'})], }; } else if (xhr.status == 413) { errorMessage = { 'mriFile': [ - 'Please make sure files are not larger than ' - + this.props.maxUploadSize, + t('Please make sure files are not larger than', + {ns: 'imaging_uploader'}) + + ' ' + this.props.maxUploadSize, ], }; } else { errorMessage = { 'mriFile': [ - 'Upload failed: received HTTP response code ' - + xhr.status, + t('Upload failed: received HTTP response code', + {ns: 'imaging_uploader'}) + + ' ' + xhr.status, ], }; } @@ -367,7 +399,7 @@ class UploadForm extends Component { } } swal.fire({ - title: 'Submission error!', + title: t('Submission error!', {ns: 'imaging_uploader'}), text: messageToPrint, type: 'error', }); @@ -383,6 +415,7 @@ class UploadForm extends Component { * @return {JSX} - React markup for the component */ render() { + const {t} = this.props; // Bind form elements to formData const form = this.state.form; form.IsPhantom.value = this.state.formData.IsPhantom; @@ -398,12 +431,17 @@ class UploadForm extends Component { const notes = ( - File cannot exceed {this.props.maxUploadSize}
- File must be of type .tgz or tar.gz or .zip
- For files that are not Phantom Scans, file name must begin with + {t('File cannot exceed', {ns: 'imaging_uploader'})} + {this.props.maxUploadSize}
+ {t('File must be of type .tgz or tar.gz or .zip', + {ns: 'imaging_uploader'})}
+ {t('For files that are not Phantom Scans, file name must begin with', + {ns: 'imaging_uploader'})} [PSCID]_[CandID]_[Visit Label]
- For example, for CandID 100000, PSCID ABC123, and - Visit Label V1 the file name should be prefixed by: + {t('For example, for CandID', {ns: 'imaging_uploader'})} + 100000, {t('PSCID', {ns: 'loris'})} ABC123, + {t('and Visit Label', {ns: 'imaging_uploader'})} V1 + {t('the file name should be prefixed by:', {ns: 'imaging_uploader'})} ABC123_100000_V1
); @@ -416,7 +454,7 @@ class UploadForm extends Component { return (
-

Upload an imaging scan

+

{t('Upload an imaging scan', {ns: 'imaging_uploader'})}


@@ -483,11 +521,11 @@ class UploadForm extends Component { } } UploadForm.propTypes = { - form: PropTypes.func, + form: PropTypes.object, mriList: PropTypes.array, imagingUploaderAutoLaunch: PropTypes.string, maxUploadSize: PropTypes.string, + t: PropTypes.func, }; -UploadForm.defaultProps = {}; -export default UploadForm; +export default withTranslation(['imaging_uploader', 'loris'])(UploadForm); diff --git a/modules/imaging_uploader/jsx/index.js b/modules/imaging_uploader/jsx/index.js index ec3863ef76c..d7d17ae0fd2 100644 --- a/modules/imaging_uploader/jsx/index.js +++ b/modules/imaging_uploader/jsx/index.js @@ -1,11 +1,16 @@ import ImagingUploader from './ImagingUploader'; import {createRoot} from 'react-dom/client'; import React from 'react'; +import i18n from 'I18nSetup'; + +import hiStrings from '../locale/hi/LC_MESSAGES/imaging_uploader.json'; /** * Render imaging_uploader on page load */ document.addEventListener('DOMContentLoaded', function() { + i18n.addResourceBundle('hi', 'imaging_uploader', hiStrings); + createRoot( document.getElementById('lorisworkspace') ).render( diff --git a/modules/imaging_uploader/locale/hi/LC_MESSAGES/imaging_uploader.po b/modules/imaging_uploader/locale/hi/LC_MESSAGES/imaging_uploader.po new file mode 100644 index 00000000000..9e8402a429a --- /dev/null +++ b/modules/imaging_uploader/locale/hi/LC_MESSAGES/imaging_uploader.po @@ -0,0 +1,137 @@ +# 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 "Imaging Uploader" +msgstr "इमेजिंग अपलोडर" + +msgid "Upload an imaging scan" +msgstr "इमेजिंग स्कैन अपलोड करें" + +msgid "Phantom Scans" +msgstr "फैंटम स्कैन" + +msgid "File to Upload" +msgstr "अपलोड करने के लिए फ़ाइल" + +msgid "Notes" +msgstr "नोट्स" + +msgid "File cannot exceed" +msgstr "फ़ाइल इससे अधिक नहीं हो सकती" + +msgid "File must be of type .tgz or tar.gz or .zip" +msgstr "फ़ाइल का प्रकार .tgz, .tar.gz या .zip होना चाहिए" + +msgid "For files that are not Phantom Scans, file name must begin with" +msgstr "जो फाइलें फैंटम स्कैन नहीं हैं, उनका नाम इससे शुरू होना चाहिए" + +msgid "For example, for CandID" +msgstr "उदाहरण के लिए, CandID के लिए" + +msgid "and Visit Label" +msgstr "और विजिट लेबल" + +msgid "the file name should be prefixed by:" +msgstr "फ़ाइल नाम की शुरुआत इससे होनी चाहिए:" + +msgid "Invalid extension for the uploaded file!" +msgstr "अपलोड की गई फ़ाइल के लिए एक्सटेंशन अमान्य है!" + +msgid "Filename extension does not match .zip, .tgz or .tar.gz " +msgstr "फ़ाइल नाम एक्सटेंशन .zip, .tgz या .tar.gz से मेल नहीं खाता" + +msgid "must be of type .tgz, .tar.gz or .zip." +msgstr "का प्रकार .tgz, .tar.gz या .zip होना चाहिए।" + +msgid "Incorrect file name!" +msgstr "अमान्य फ़ाइल नाम!" + +msgid "Could not determine PSCID, CandID and Visit Label based on the filename!" +msgstr "फ़ाइल नाम के आधार पर PSCID, CandID और Visit Label निर्धारित नहीं किया जा सका!" + +msgid "File already exists!" +msgstr "फ़ाइल पहले से मौजूद है!" + +msgid "A file with this name has already successfully passed the MRI pipeline!" +msgstr "इस नाम की फ़ाइल पहले ही MRI पाइपलाइन से सफलतापूर्वक गुजर चुकी है!" + +msgid "File is currently processing!" +msgstr "फ़ाइल वर्तमान में प्रोसेस हो रही है!" + +msgid "A file with this name is currently going through the MRI pipeline!" +msgstr "इस नाम की फ़ाइल वर्तमान में MRI पाइपलाइन से गुजर रही है!" + +msgid "Are you sure?" +msgstr "क्या आप निश्चित हैं?" + +msgid "A file with this name already exists! Would you like to overwrite the existing file?" +msgstr "इस नाम की फ़ाइल पहले से मौजूद है! क्या आप मौजूदा फ़ाइल को अधिलेखित करना चाहेंगे?" + +msgid "Yes, I am sure!" +msgstr "हाँ, मैं निश्चित हूँ!" + +msgid "No, cancel it!" +msgstr "नहीं, रद्द करें!" + +msgid "Cancelled" +msgstr "रद्द किया गया" + +msgid "Your upload has been cancelled." +msgstr "आपका अपलोड रद्द कर दिया गया है।" + +msgid "A file with this name has been uploaded but has not yet been processed by the MRI pipeline. Would you like to overwrite the existing file?" +msgstr "इस नाम की फ़ाइल अपलोड की गई है लेकिन अभी MRI पाइपलाइन द्वारा प्रोसेस नहीं हुई है। क्या आप मौजूदा फ़ाइल को अधिलेखित करना चाहेंगे?" + +msgid "Upload Successful!" +msgstr "अपलोड सफल!" + +msgid "Processing of this file by the MRI pipeline has started" +msgstr "इस फ़ाइल का MRI पाइपलाइन द्वारा प्रोसेसिंग शुरू हो गई है" + +msgid "Select this upload in the result table to view the processing progress" +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 "अपलोड विफल: HTTP प्रतिक्रिया कोड प्राप्त हुआ" + +msgid "Submission error!" +msgstr "सबमिशन त्रुटि!" + +msgid "Clear Filters" +msgstr "फ़िल्टर साफ़ करें" + +msgid "Log Viewer" +msgstr "लॉग व्यूअर" + +msgid "Logs to display" +msgstr "दिखाने के लिए लॉग्स" + +msgid "Summary" +msgstr "सारांश" + +msgid "Detailed" +msgstr "विस्तृत" + diff --git a/modules/imaging_uploader/locale/imaging_uploader.pot b/modules/imaging_uploader/locale/imaging_uploader.pot index 91fe4ff4ab9..cf6b885b6f3 100644 --- a/modules/imaging_uploader/locale/imaging_uploader.pot +++ b/modules/imaging_uploader/locale/imaging_uploader.pot @@ -21,3 +21,117 @@ msgstr "" msgid "Imaging Uploader" msgstr "" +msgid "Upload an imaging scan" +msgstr "" + +msgid "Phantom Scans" +msgstr "" + +msgid "File to Upload" +msgstr "" + +msgid "Notes" +msgstr "" + +msgid "File cannot exceed" +msgstr "" + +msgid "File must be of type .tgz or tar.gz or .zip" +msgstr "" + +msgid "For files that are not Phantom Scans, file name must begin with" +msgstr "" + +msgid "For example, for CandID" +msgstr "" + +msgid "and Visit Label" +msgstr "" + +msgid "the file name should be prefixed by:" +msgstr "" + +msgid "Invalid extension for the uploaded file!" +msgstr "" + +msgid "Filename extension does not match .zip, .tgz or .tar.gz " +msgstr "" + +msgid "must be of type .tgz, .tar.gz or .zip." +msgstr "" + +msgid "Incorrect file name!" +msgstr "" + +msgid "Could not determine PSCID, CandID and Visit Label based on the filename!" +msgstr "" + +msgid "File already exists!" +msgstr "" + +msgid "A file with this name has already successfully passed the MRI pipeline!" +msgstr "" + +msgid "File is currently processing!" +msgstr "" + +msgid "A file with this name is currently going through the MRI pipeline!" +msgstr "" + +msgid "Are you sure?" +msgstr "" + +msgid "A file with this name already exists! Would you like to overwrite the existing file?" +msgstr "" + +msgid "Yes, I am sure!" +msgstr "" + +msgid "No, cancel it!" +msgstr "" + +msgid "Cancelled" +msgstr "" + +msgid "Your upload has been cancelled." +msgstr "" + +msgid "A file with this name has been uploaded but has not yet been processed by the MRI pipeline. Would you like to overwrite the existing file?" +msgstr "" + +msgid "Upload Successful!" +msgstr "" + +msgid "Processing of this file by the MRI pipeline has started" +msgstr "" + +msgid "Select this upload in the result table to view the processing progress" +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 "Clear Filters" +msgstr "" + +msgid "Log Viewer" +msgstr "" + +msgid "Logs to display" +msgstr "" + +msgid "Summary" +msgstr "" + +msgid "Detailed" +msgstr "" +