From 4298027a93f961df413cb51891d84c7b184898d5 Mon Sep 17 00:00:00 2001 From: Saket Hatwar Date: Fri, 29 Aug 2025 05:35:17 -0400 Subject: [PATCH 1/4] Add Translation --- Makefile | 2 + .../imaging_uploader/jsx/ImagingUploader.js | 16 +- modules/imaging_uploader/jsx/LogPanel.js | 18 ++- modules/imaging_uploader/jsx/UploadForm.js | 139 +++++++++++------- modules/imaging_uploader/jsx/index.js | 7 + .../hi/LC_MESSAGES/imaging_uploader.json | 41 ++++++ .../locale/hi/LC_MESSAGES/imaging_uploader.po | 137 +++++++++++++++++ .../locale/imaging_uploader.pot | 114 ++++++++++++++ 8 files changed, 405 insertions(+), 69 deletions(-) create mode 100644 modules/imaging_uploader/locale/hi/LC_MESSAGES/imaging_uploader.json create mode 100644 modules/imaging_uploader/locale/hi/LC_MESSAGES/imaging_uploader.po diff --git a/Makefile b/Makefile index c614da9d7bb..eaf1b9cd446 100755 --- a/Makefile +++ b/Makefile @@ -99,6 +99,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/modules/imaging_uploader/jsx/ImagingUploader.js b/modules/imaging_uploader/jsx/ImagingUploader.js index a698295e320..cedd2f2d827 100644 --- a/modules/imaging_uploader/jsx/ImagingUploader.js +++ b/modules/imaging_uploader/jsx/ImagingUploader.js @@ -3,7 +3,8 @@ import PropTypes from 'prop-types'; import FilterForm from 'FilterForm'; import {Tabs, TabPane} from 'Tabs'; import Loader from 'Loader'; - +import i18n from 'I18nSetup'; +import {withTranslation} from 'react-i18next'; import LogPanel from './LogPanel'; import UploadForm from './UploadForm'; import {TextboxElement, SelectElement, ButtonElement} from 'jsx/Form'; @@ -211,13 +212,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 +240,13 @@ class ImagingUploader extends Component {
- +
@@ -265,6 +267,7 @@ class ImagingUploader extends Component { imagingUploaderAutoLaunch={ this.state.data.imagingUploaderAutoLaunch } + t={t} /> @@ -274,6 +277,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 +240,24 @@ 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 +272,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 +310,16 @@ 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 +342,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 +359,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 +388,7 @@ class UploadForm extends Component { } } swal.fire({ - title: 'Submission error!', + title: t('Submission error!', {ns: 'imaging_uploader'}), text: messageToPrint, type: 'error', }); @@ -383,6 +404,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 +420,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 +443,7 @@ class UploadForm extends Component { return (
-

Upload an imaging scan

+

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


@@ -483,11 +510,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..b9f40fd8af1 100644 --- a/modules/imaging_uploader/jsx/index.js +++ b/modules/imaging_uploader/jsx/index.js @@ -1,11 +1,18 @@ import ImagingUploader from './ImagingUploader'; import {createRoot} from 'react-dom/client'; import React from 'react'; +import i18n from 'I18nSetup'; +import {withTranslation} from 'react-i18next'; + +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.json b/modules/imaging_uploader/locale/hi/LC_MESSAGES/imaging_uploader.json new file mode 100644 index 00000000000..b5e2a88b7b9 --- /dev/null +++ b/modules/imaging_uploader/locale/hi/LC_MESSAGES/imaging_uploader.json @@ -0,0 +1,41 @@ +{ + "Imaging Uploader": "इमेजिंग अपलोडर", + "Upload an imaging scan": "इमेजिंग स्कैन अपलोड करें", + "Phantom Scans": "फैंटम स्कैन", + "File to Upload": "अपलोड करने के लिए फ़ाइल", + "Notes": "नोट्स", + "File cannot exceed": "फ़ाइल इससे अधिक नहीं हो सकती", + "File must be of type .tgz or tar.gz or .zip": "फ़ाइल का प्रकार .tgz, .tar.gz या .zip होना चाहिए", + "For files that are not Phantom Scans, file name must begin with": "जो फाइलें फैंटम स्कैन नहीं हैं, उनका नाम इससे शुरू होना चाहिए", + "For example, for CandID": "उदाहरण के लिए, CandID के लिए", + "and Visit Label": "और विजिट लेबल", + "the file name should be prefixed by:": "फ़ाइल नाम की शुरुआत इससे होनी चाहिए:", + "Invalid extension for the uploaded file!": "अपलोड की गई फ़ाइल के लिए एक्सटेंशन अमान्य है!", + "Filename extension does not match .zip, .tgz or .tar.gz ": "फ़ाइल नाम एक्सटेंशन .zip, .tgz या .tar.gz से मेल नहीं खाता", + "must be of type .tgz, .tar.gz or .zip.": "का प्रकार .tgz, .tar.gz या .zip होना चाहिए।", + "Incorrect file name!": "अमान्य फ़ाइल नाम!", + "Could not determine PSCID, CandID and Visit Label based on the filename!": "फ़ाइल नाम के आधार पर PSCID, CandID और Visit Label निर्धारित नहीं किया जा सका!", + "File already exists!": "फ़ाइल पहले से मौजूद है!", + "A file with this name has already successfully passed the MRI pipeline!": "इस नाम की फ़ाइल पहले ही MRI पाइपलाइन से सफलतापूर्वक गुजर चुकी है!", + "File is currently processing!": "फ़ाइल वर्तमान में प्रोसेस हो रही है!", + "A file with this name is currently going through the MRI pipeline!": "इस नाम की फ़ाइल वर्तमान में MRI पाइपलाइन से गुजर रही है!", + "Are you sure?": "क्या आप निश्चित हैं?", + "A file with this name already exists! Would you like to overwrite the existing file?": "इस नाम की फ़ाइल पहले से मौजूद है! क्या आप मौजूदा फ़ाइल को अधिलेखित करना चाहेंगे?", + "Yes, I am sure!": "हाँ, मैं निश्चित हूँ!", + "No, cancel it!": "नहीं, रद्द करें!", + "Cancelled": "रद्द किया गया", + "Your upload has been cancelled.": "आपका अपलोड रद्द कर दिया गया है।", + "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?": "इस नाम की फ़ाइल अपलोड की गई है लेकिन अभी MRI पाइपलाइन द्वारा प्रोसेस नहीं हुई है। क्या आप मौजूदा फ़ाइल को अधिलेखित करना चाहेंगे?", + "Upload Successful!": "अपलोड सफल!", + "Processing of this file by the MRI pipeline has started": "इस फ़ाइल का MRI पाइपलाइन द्वारा प्रोसेसिंग शुरू हो गई है", + "Select this upload in the result table to view the processing progress": "प्रोसेसिंग प्रगति देखने के लिए परिणाम तालिका में इस अपलोड का चयन करें", + "Upload failed: a network error occured": "अपलोड विफल: नेटवर्क त्रुटि हुई", + "Please make sure files are not larger than": "कृपया सुनिश्चित करें कि फ़ाइलें इससे बड़ी न हों", + "Upload failed: received HTTP response code": "अपलोड विफल: HTTP प्रतिक्रिया कोड प्राप्त हुआ", + "Submission error!": "सबमिशन त्रुटि!", + "Clear Filters": "फ़िल्टर साफ़ करें", + "Log Viewer": "लॉग व्यूअर", + "Logs to display": "दिखाने के लिए लॉग्स", + "Summary": "सारांश", + "Detailed": "विस्तृत" +} \ No newline at end of file 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 "" + From 70476a01a6bac2b494c33938fa7dc1d066769398 Mon Sep 17 00:00:00 2001 From: Saket Hatwar Date: Fri, 29 Aug 2025 15:31:47 -0400 Subject: [PATCH 2/4] lint --- .../imaging_uploader/jsx/ImagingUploader.js | 1 - modules/imaging_uploader/jsx/UploadForm.js | 40 +++++++++--------- modules/imaging_uploader/jsx/index.js | 2 - .../hi/LC_MESSAGES/imaging_uploader.json | 41 ------------------- 4 files changed, 21 insertions(+), 63 deletions(-) delete mode 100644 modules/imaging_uploader/locale/hi/LC_MESSAGES/imaging_uploader.json diff --git a/modules/imaging_uploader/jsx/ImagingUploader.js b/modules/imaging_uploader/jsx/ImagingUploader.js index cedd2f2d827..d036e84f228 100644 --- a/modules/imaging_uploader/jsx/ImagingUploader.js +++ b/modules/imaging_uploader/jsx/ImagingUploader.js @@ -3,7 +3,6 @@ import PropTypes from 'prop-types'; import FilterForm from 'FilterForm'; import {Tabs, TabPane} from 'Tabs'; import Loader from 'Loader'; -import i18n from 'I18nSetup'; import {withTranslation} from 'react-i18next'; import LogPanel from './LogPanel'; import UploadForm from './UploadForm'; diff --git a/modules/imaging_uploader/jsx/UploadForm.js b/modules/imaging_uploader/jsx/UploadForm.js index dbed305f379..2e96e87af6f 100644 --- a/modules/imaging_uploader/jsx/UploadForm.js +++ b/modules/imaging_uploader/jsx/UploadForm.js @@ -145,9 +145,9 @@ class UploadForm extends Component { if (!fileName.match(properExt)) { swal.fire({ title: t('Invalid extension for the uploaded file!', - {ns: 'imaging_uploader'}), + {ns: 'imaging_uploader'}), text: t('Filename extension does not match .zip, .tgz or .tar.gz ', - {ns: 'imaging_uploader'}), + {ns: 'imaging_uploader'}), type: 'error', confirmButtonText: t('OK', {ns: 'imaging_uploader'}), }); @@ -156,7 +156,7 @@ class UploadForm extends Component { mriFile: t('The file', {ns: 'imaging_uploader'}) + ' ' + fileName + ' ' + t('must be of type .tgz, .tar.gz or .zip.', - {ns: 'imaging_uploader'}), + {ns: 'imaging_uploader'}), candID: undefined, pSCID: undefined, visitLabel: undefined, @@ -194,8 +194,9 @@ class UploadForm extends Component { if (mriFile.status === 'Success') { swal.fire({ title: t('File already exists!', {ns: 'imaging_uploader'}), - text: t('A file with this name has already successfully passed the MRI pipeline!', - {ns: 'imaging_uploader'}), + text: t('A file with this name has already successfully' + +' passed the MRI pipeline!', + {ns: 'imaging_uploader'}), type: 'error', confirmButtonText: t('OK', {ns: 'imaging_uploader'}), }); @@ -206,8 +207,9 @@ class UploadForm extends Component { if (mriFile.status === 'In Progress...') { swal.fire({ title: t('File is currently processing!', {ns: 'imaging_uploader'}), - text: t('A file with this name is currently going through the MRI pipeline!', - {ns: 'imaging_uploader'}), + text: t('A file with this name is currently going' + +' through the MRI pipeline!', + {ns: 'imaging_uploader'}), type: 'error', confirmButtonText: t('OK', {ns: 'imaging_uploader'}), }); @@ -244,7 +246,7 @@ class UploadForm extends Component { 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'}), + {ns: 'imaging_uploader'}), type: 'warning', showCancelButton: true, confirmButtonText: t('Yes, I am sure!', {ns: 'imaging_uploader'}), @@ -311,9 +313,9 @@ class UploadForm extends Component { this.props.imagingUploaderAutoLaunch === '1' ) { text = t('Processing of this file by the MRI pipeline has started', - {ns: 'imaging_uploader'}) + '\n' + {ns: 'imaging_uploader'}) + '\n' + t('Select this upload in the result table to view the processing progress', - {ns: 'imaging_uploader'}); + {ns: 'imaging_uploader'}); } swal.fire({ title: t('Upload Successful!', {ns: 'imaging_uploader'}), @@ -360,13 +362,13 @@ class UploadForm extends Component { } else if (xhr.status == 0) { errorMessage = { 'mriFile': [t('Upload failed: a network error occured', - {ns: 'imaging_uploader'})], + {ns: 'imaging_uploader'})], }; } else if (xhr.status == 413) { errorMessage = { 'mriFile': [ t('Please make sure files are not larger than', - {ns: 'imaging_uploader'}) + {ns: 'imaging_uploader'}) + ' ' + this.props.maxUploadSize, ], }; @@ -374,7 +376,7 @@ class UploadForm extends Component { errorMessage = { 'mriFile': [ t('Upload failed: received HTTP response code', - {ns: 'imaging_uploader'}) + {ns: 'imaging_uploader'}) + ' ' + xhr.status, ], }; @@ -420,17 +422,17 @@ class UploadForm extends Component { const notes = ( - {t('File cannot exceed', {ns: 'imaging_uploader'})} + {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'})}
+ {ns: 'imaging_uploader'})}
{t('For files that are not Phantom Scans, file name must begin with', - {ns: 'imaging_uploader'})} + {ns: 'imaging_uploader'})} [PSCID]_[CandID]_[Visit Label]
{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'})} + 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
); diff --git a/modules/imaging_uploader/jsx/index.js b/modules/imaging_uploader/jsx/index.js index b9f40fd8af1..d7d17ae0fd2 100644 --- a/modules/imaging_uploader/jsx/index.js +++ b/modules/imaging_uploader/jsx/index.js @@ -2,7 +2,6 @@ import ImagingUploader from './ImagingUploader'; import {createRoot} from 'react-dom/client'; import React from 'react'; import i18n from 'I18nSetup'; -import {withTranslation} from 'react-i18next'; import hiStrings from '../locale/hi/LC_MESSAGES/imaging_uploader.json'; @@ -10,7 +9,6 @@ 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( diff --git a/modules/imaging_uploader/locale/hi/LC_MESSAGES/imaging_uploader.json b/modules/imaging_uploader/locale/hi/LC_MESSAGES/imaging_uploader.json deleted file mode 100644 index b5e2a88b7b9..00000000000 --- a/modules/imaging_uploader/locale/hi/LC_MESSAGES/imaging_uploader.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "Imaging Uploader": "इमेजिंग अपलोडर", - "Upload an imaging scan": "इमेजिंग स्कैन अपलोड करें", - "Phantom Scans": "फैंटम स्कैन", - "File to Upload": "अपलोड करने के लिए फ़ाइल", - "Notes": "नोट्स", - "File cannot exceed": "फ़ाइल इससे अधिक नहीं हो सकती", - "File must be of type .tgz or tar.gz or .zip": "फ़ाइल का प्रकार .tgz, .tar.gz या .zip होना चाहिए", - "For files that are not Phantom Scans, file name must begin with": "जो फाइलें फैंटम स्कैन नहीं हैं, उनका नाम इससे शुरू होना चाहिए", - "For example, for CandID": "उदाहरण के लिए, CandID के लिए", - "and Visit Label": "और विजिट लेबल", - "the file name should be prefixed by:": "फ़ाइल नाम की शुरुआत इससे होनी चाहिए:", - "Invalid extension for the uploaded file!": "अपलोड की गई फ़ाइल के लिए एक्सटेंशन अमान्य है!", - "Filename extension does not match .zip, .tgz or .tar.gz ": "फ़ाइल नाम एक्सटेंशन .zip, .tgz या .tar.gz से मेल नहीं खाता", - "must be of type .tgz, .tar.gz or .zip.": "का प्रकार .tgz, .tar.gz या .zip होना चाहिए।", - "Incorrect file name!": "अमान्य फ़ाइल नाम!", - "Could not determine PSCID, CandID and Visit Label based on the filename!": "फ़ाइल नाम के आधार पर PSCID, CandID और Visit Label निर्धारित नहीं किया जा सका!", - "File already exists!": "फ़ाइल पहले से मौजूद है!", - "A file with this name has already successfully passed the MRI pipeline!": "इस नाम की फ़ाइल पहले ही MRI पाइपलाइन से सफलतापूर्वक गुजर चुकी है!", - "File is currently processing!": "फ़ाइल वर्तमान में प्रोसेस हो रही है!", - "A file with this name is currently going through the MRI pipeline!": "इस नाम की फ़ाइल वर्तमान में MRI पाइपलाइन से गुजर रही है!", - "Are you sure?": "क्या आप निश्चित हैं?", - "A file with this name already exists! Would you like to overwrite the existing file?": "इस नाम की फ़ाइल पहले से मौजूद है! क्या आप मौजूदा फ़ाइल को अधिलेखित करना चाहेंगे?", - "Yes, I am sure!": "हाँ, मैं निश्चित हूँ!", - "No, cancel it!": "नहीं, रद्द करें!", - "Cancelled": "रद्द किया गया", - "Your upload has been cancelled.": "आपका अपलोड रद्द कर दिया गया है।", - "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?": "इस नाम की फ़ाइल अपलोड की गई है लेकिन अभी MRI पाइपलाइन द्वारा प्रोसेस नहीं हुई है। क्या आप मौजूदा फ़ाइल को अधिलेखित करना चाहेंगे?", - "Upload Successful!": "अपलोड सफल!", - "Processing of this file by the MRI pipeline has started": "इस फ़ाइल का MRI पाइपलाइन द्वारा प्रोसेसिंग शुरू हो गई है", - "Select this upload in the result table to view the processing progress": "प्रोसेसिंग प्रगति देखने के लिए परिणाम तालिका में इस अपलोड का चयन करें", - "Upload failed: a network error occured": "अपलोड विफल: नेटवर्क त्रुटि हुई", - "Please make sure files are not larger than": "कृपया सुनिश्चित करें कि फ़ाइलें इससे बड़ी न हों", - "Upload failed: received HTTP response code": "अपलोड विफल: HTTP प्रतिक्रिया कोड प्राप्त हुआ", - "Submission error!": "सबमिशन त्रुटि!", - "Clear Filters": "फ़िल्टर साफ़ करें", - "Log Viewer": "लॉग व्यूअर", - "Logs to display": "दिखाने के लिए लॉग्स", - "Summary": "सारांश", - "Detailed": "विस्तृत" -} \ No newline at end of file From 5d3beaa99f147f96e07952adcad325f43897aa1d Mon Sep 17 00:00:00 2001 From: Saket Hatwar Date: Fri, 29 Aug 2025 16:11:15 -0400 Subject: [PATCH 3/4] lint --- modules/imaging_uploader/jsx/UploadForm.js | 29 ++++++++++++++-------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/modules/imaging_uploader/jsx/UploadForm.js b/modules/imaging_uploader/jsx/UploadForm.js index 2e96e87af6f..050b5a4b4a3 100644 --- a/modules/imaging_uploader/jsx/UploadForm.js +++ b/modules/imaging_uploader/jsx/UploadForm.js @@ -221,18 +221,22 @@ class UploadForm extends Component { swal.fire({ title: t('Are you sure?', {ns: 'imaging_uploader'}), text: t('A file with this name already exists! ' - +'Would you like to overwrite the existing file?', {ns: 'imaging_uploader'}), + + 'Would you like to overwrite the existing file?', + {ns: 'imaging_uploader'}), type: 'warning', showCancelButton: true, - confirmButtonText: t('Yes, I am sure!', {ns: 'imaging_uploader'}), - cancelButtonText: t('No, cancel it!', {ns: 'imaging_uploader'}), + 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( t('Cancelled', {ns: 'imaging_uploader'}), - t('Your upload has been cancelled.', {ns: 'imaging_uploader'}), + t('Your upload has been cancelled.', + {ns: 'imaging_uploader'}), 'error' ); } @@ -249,15 +253,18 @@ class UploadForm extends Component { {ns: 'imaging_uploader'}), type: 'warning', showCancelButton: true, - confirmButtonText: t('Yes, I am sure!', {ns: 'imaging_uploader'}), - cancelButtonText: t('No, cancel it!', {ns: 'imaging_uploader'}), + 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( t('Cancelled', {ns: 'imaging_uploader'}), - t('Your upload has been cancelled.', {ns: 'imaging_uploader'}), + t('Your upload has been cancelled.', + {ns: 'imaging_uploader'}), 'error' ); } @@ -312,10 +319,12 @@ class UploadForm extends Component { if (this.props.imagingUploaderAutoLaunch === 'true' || this.props.imagingUploaderAutoLaunch === '1' ) { - text = t('Processing of this file by the MRI pipeline has started', + 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'}); + + t('Select this upload in the result table'+ + ' to view the processing progress', + {ns: 'imaging_uploader'}); } swal.fire({ title: t('Upload Successful!', {ns: 'imaging_uploader'}), From e2028e1f8326f37231fe53111d24b1ab4a7da143 Mon Sep 17 00:00:00 2001 From: Saket Hatwar Date: Mon, 6 Oct 2025 06:45:29 -0400 Subject: [PATCH 4/4] namespace --- locale/hi/LC_MESSAGES/loris.po | 12 ++++++++++++ locale/loris.pot | 14 ++++++++++++-- modules/imaging_uploader/jsx/ImagingUploader.js | 2 +- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/locale/hi/LC_MESSAGES/loris.po b/locale/hi/LC_MESSAGES/loris.po index 353699aabc6..9a8f59716af 100644 --- a/locale/hi/LC_MESSAGES/loris.po +++ b/locale/hi/LC_MESSAGES/loris.po @@ -117,6 +117,15 @@ msgstr "हाँ" msgid "No" msgstr "नहीं" +msgid "Browse" +msgstr "ब्राउज़ करें" + +msgid "Upload" +msgstr "अपलोड करें" + +msgid "Clear Filters" +msgstr "फ़िल्टर हटाएँ" + # Common candidate terms msgid "PSCID" msgstr "पीएससीआईडी" @@ -124,6 +133,9 @@ msgstr "पीएससीआईडी" msgid "DCCID" msgstr "डीसीसीआईडी" +msgid "CandID" +msgstr "उम्मीदवार आईडी" + msgid "Visit Label" msgstr "दौरे का लेबल" diff --git a/locale/loris.pot b/locale/loris.pot index 83bd1dc01c5..4af8096ef45 100644 --- a/locale/loris.pot +++ b/locale/loris.pot @@ -116,6 +116,15 @@ msgstr "" msgid "No" msgstr "" +msgid "Clear Filters" +msgstr "" + +msgid "Browse" +msgstr "" + +msgid "Upload" +msgstr "" + # Common candidate terms msgid "PSCID" msgstr "" @@ -123,6 +132,9 @@ msgstr "" msgid "DCCID" msgstr "" +msgid "CandID" +msgstr "" + msgid "Visit Label" msgstr "" @@ -173,5 +185,3 @@ msgstr "" msgid "NEW" msgstr "" -msgid "Updated" -msgstr "" diff --git a/modules/imaging_uploader/jsx/ImagingUploader.js b/modules/imaging_uploader/jsx/ImagingUploader.js index d036e84f228..5c6b0ce3a20 100644 --- a/modules/imaging_uploader/jsx/ImagingUploader.js +++ b/modules/imaging_uploader/jsx/ImagingUploader.js @@ -239,7 +239,7 @@ class ImagingUploader extends Component {