diff --git a/Makefile b/Makefile index 0eb144d3d70..9172c699303 100755 --- a/Makefile +++ b/Makefile @@ -123,6 +123,8 @@ locales: msgfmt -o modules/media/locale/ja/LC_MESSAGES/media.mo modules/media/locale/ja/LC_MESSAGES/media.po msgfmt -o modules/module_manager/locale/ja/LC_MESSAGES/module_manager.mo modules/module_manager/locale/ja/LC_MESSAGES/module_manager.po msgfmt -o modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.mo modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.po + msgfmt -o modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.mo modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.po + npx i18next-conv -l hi -s modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.po -t modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.json msgfmt -o modules/next_stage/locale/ja/LC_MESSAGES/next_stage.mo modules/next_stage/locale/ja/LC_MESSAGES/next_stage.po msgfmt -o modules/oidc/locale/ja/LC_MESSAGES/oidc.mo modules/oidc/locale/ja/LC_MESSAGES/oidc.po msgfmt -o modules/publication/locale/ja/LC_MESSAGES/publication.mo modules/publication/locale/ja/LC_MESSAGES/publication.po @@ -160,7 +162,9 @@ login: modules/login/locale/ja/LC_MESSAGES/login.mo module_manager: modules/module_manager/locale/ja/LC_MESSAGES/module_manager.mo target=module_manager npm run compile -mri_violations: modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.mo +mri_violations: + msgfmt -o modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.mo modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.po + npx i18next-conv -l hi -s modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.po -t modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.json target=mri_violations npm run compile issue_tracker: modules/issue_tracker/locale/ja/LC_MESSAGES/issue_tracker.mo diff --git a/locale/hi/LC_MESSAGES/loris.po b/locale/hi/LC_MESSAGES/loris.po index 32d08fba0ca..ee832f91a59 100644 --- a/locale/hi/LC_MESSAGES/loris.po +++ b/locale/hi/LC_MESSAGES/loris.po @@ -187,6 +187,15 @@ msgstr "उन्नत फ़िल्टर दिखाएँ" msgid "Hide Advanced Filters" msgstr "उन्नत फ़िल्टर छुपाएँ" +msgid "Language" +msgstr "भाषा" + +msgid "Access denied" +msgstr "पहुँच अस्वीकृत" + +msgid "No." +msgstr "क्रमांक" + # Data table strings msgid "{{pageCount}} rows displayed of {{totalCount}}." msgstr "{{totalCount}} में से {{pageCount}} पंक्तियाँ प्रदर्शित" diff --git a/locale/loris.pot b/locale/loris.pot index 5d0d10f350e..fffcdb83ce3 100644 --- a/locale/loris.pot +++ b/locale/loris.pot @@ -202,6 +202,12 @@ msgstr "" msgid "Language" msgstr "" +msgid "Access denied" +msgstr "" + +msgid "No." +msgstr "" + # Data table strings msgid "{{pageCount}} rows displayed of {{totalCount}}." msgstr "" @@ -259,3 +265,4 @@ msgstr "" msgid "In Progress" msgstr "" + diff --git a/modules/mri_violations/jsx/mriViolationsIndex.js b/modules/mri_violations/jsx/mriViolationsIndex.js index 9008bf7617c..a8a46d3546b 100644 --- a/modules/mri_violations/jsx/mriViolationsIndex.js +++ b/modules/mri_violations/jsx/mriViolationsIndex.js @@ -3,6 +3,10 @@ import FilterableDataTable from 'FilterableDataTable'; import React, {useEffect, useState} from 'react'; import PropTypes from 'prop-types'; import ProtocolModal from './protocolModal.js'; +import i18n from 'I18nSetup'; +import {withTranslation} from 'react-i18next'; + +import hiStrings from '../locale/hi/LC_MESSAGES/mri_violations.json'; /** * Entry point for the MRI Violatons module. @@ -17,6 +21,8 @@ function MRIViolationsIndex(props) { const [isError, setIsError] = useState(false); const [data, setData] = useState([]); const mapper = columnMapper(fieldOptions); + const {t} = props; + const violationsModal = (violationModal !== false) ? setViolationModal(false)} @@ -109,7 +115,8 @@ function MRIViolationsIndex(props) { let resolutionStatusStyle; let resolutionStatus; - if (column === 'Type of Problem' && cell === 'Protocol Violation') { + if (column === t('Type of Problem', {ns: 'mri_violations'}) && + cell === t('Protocol Violation', {ns: 'mri_violations'})) { return ( Protocol Violation + }>{t('Protocol Violation', {ns: 'mri_violations'})} ); } if ( - column === 'Type of Problem' && - cell === 'Could not identify scan type' + column === t('Type of Problem', {ns: 'mri_violations'}) && + cell === t('Could not identify scan type', {ns: 'mri_violations'}) ) { const seriesDescription = rowData[ - 'Series Description or Scan Type' + t('Series Description or Scan Type', {ns: 'mri_violations'}) ]; return ( @@ -259,74 +266,77 @@ function MRIViolationsIndex(props) { } return [ { - label: 'Patient Name', show: true, filter: { + label: t('Patient Name', {ns: 'mri_violations'}), show: true, filter: { name: 'patientName', type: 'text', }, }, { - label: 'Project', show: true, filter: { + label: t('Project', {ns: 'loris'}), show: true, filter: { name: 'project', type: 'select', options: fieldoptions.projects, }, }, { - label: 'Cohort', show: true, filter: { + label: t('Cohort', {ns: 'loris'}), show: true, filter: { name: 'cohort', type: 'select', options: fieldoptions.cohorts, }, }, { - label: 'Site', show: true, filter: { + label: t('Site', {ns: 'loris'}), show: true, filter: { name: 'site', type: 'select', options: fieldoptions.sites, }, }, { - label: 'Time Run', show: true, filter: { + label: t('Time Run', {ns: 'mri_violations'}), show: true, filter: { name: 'timeRun', type: 'datetime', }, }, { - label: 'Image File', show: true, filter: { + label: t('Image File', {ns: 'mri_violations'}), show: true, filter: { name: 'mincFile', type: 'text', }, }, { - label: 'Series Description or Scan Type', show: true, filter: { + label: t('Series Description or Scan Type', {ns: 'mri_violations'}), + show: true, filter: { name: 'seriesOrType', type: 'text', }, }, { - label: 'Type of Problem', show: true, filter: { + label: t('Type of Problem', {ns: 'mri_violations'}), + show: true, filter: { name: 'typeOfProblem', type: 'select', options: problemtypes, }, }, { - label: 'Resolution Status', show: true, filter: { + label: t('Resolution Status', {ns: 'mri_violations'}), + show: true, filter: { name: 'resolutionStatus', type: 'select', options: { - 'unresolved': 'Unresolved', - 'reran': 'Reran', - 'emailed': 'emailed site/pending', - 'inserted': 'Inserted', - 'rejected': 'Rejected', - 'inserted_flag': 'Inserted with flag', - 'other': 'Other', + 'unresolved': t('Unresolved', {ns: 'mri_violations'}), + 'reran': t('Reran', {ns: 'mri_violations'}), + 'emailed': t('emailed site/pending', {ns: 'mri_violations'}), + 'inserted': t('inserted', {ns: 'mri_violations'}), + 'rejected': t('rejected', {ns: 'mri_violations'}), + 'inserted_flag': t('inserted with flag', {ns: 'mri_violations'}), + 'other': t('other', {ns: 'mri_violations'}), }, }, }, { - label: 'Series UID', show: false, filter: { + label: t('Series UID', {ns: 'mri_violations'}), show: false, filter: { name: 'seriesUID', type: 'text', }, @@ -338,7 +348,7 @@ function MRIViolationsIndex(props) { {label: 'PSCID', show: false}, // Add fake column for resolution dropdown - {label: 'Select Resolution', show: true}, + {label: t('Select Resolution', {ns: 'mri_violations'}), show: true}, ]; }; @@ -348,7 +358,8 @@ function MRIViolationsIndex(props) { {!isLoaded ? : isError ? -

An error occurred while loading the page.

: +

{t('An error occurred while loading the page.', + {ns: 'mri_violations'})}

: { + i18n.addResourceBundle('hi', 'mri_violations', hiStrings); + + const ViolationsIndex = withTranslation( + ['mri_violations', 'loris'] + )(MRIViolationsIndex); + ReactDOM.createRoot( document.getElementById('lorisworkspace') ).render( - , diff --git a/modules/mri_violations/jsx/protocolModal.js b/modules/mri_violations/jsx/protocolModal.js index 8e3d542d1c5..9baea4796f9 100644 --- a/modules/mri_violations/jsx/protocolModal.js +++ b/modules/mri_violations/jsx/protocolModal.js @@ -3,7 +3,7 @@ import StaticDataTable from 'StaticDataTable'; import React, {useEffect, useState} from 'react'; import PropTypes from 'prop-types'; - +import {withTranslation} from 'react-i18next'; /** * A Modal popup to display a protocol violation of any @@ -13,16 +13,18 @@ import PropTypes from 'prop-types'; * @return {JSX} */ function ProtocolModal(props) { + const {t} = props; switch (props.Type) { case 'protocolviolation': - return ; + return ; case 'protocolcheck': - return ; + return ; default: return null; } } ProtocolModal.propTypes = { Type: PropTypes.string, + t: PropTypes.func, }; /** @@ -38,6 +40,7 @@ ProtocolModal.propTypes = { function ProtocolViolationModal(props) { const [data, setData] = useState([]); const [protocols, setMRIProtocols] = useState([]); + const {t} = props; useEffect(() => { fetch(props.URL + '?format=json' + @@ -57,42 +60,43 @@ function ProtocolViolationModal(props) { let violations = []; - let title = 'Violations for SeriesUID ' + props.SeriesUID; + let title = t('Violations for SeriesUID', {ns: 'mri_violations'}) + + ' ' + props.SeriesUID; for (const violation of data) { - title = 'Violations for ' + violation[4]; + title = t('Violations for', {ns: 'mri_violations'}) + ' ' + violation[4]; violations.push(
-
CandID
+
{t('CandID', {ns: 'mri_violations'})}
{violation[0]}
-
PSCID
+
{t('PSCID', {ns: 'loris'})}
{violation[1]}
-
Time Run
+
{t('Time Run', {ns: 'mri_violations'})}
{violation[2]}
-
Series Description
+
{t('Series Description', {ns: 'mri_violations'})}
{violation[3]}
-
Image Location
+
{t('Image Location', {ns: 'mri_violations'})}
{violation[4]}
-
Patient Name
+
{t('Patient Name', {ns: 'mri_violations'})}
{violation[5]}
-
Series UID
+
{t('Series UID', {ns: 'mri_violations'})}
{props.SeriesUID}
-
Echo Time
+
{t('Echo Time', {ns: 'mri_violations'})}
{violation[8]}
@@ -100,21 +104,21 @@ function ProtocolViolationModal(props) { - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -166,23 +170,23 @@ function ProtocolViolationModal(props) {
Protocol GroupTRTETISlice ThicknessXspaceYspaceZspaceXstepYstepZstepTimeImage TypePhase Encoding DirectionEcho Number{t('Protocol Group', {ns: 'mri_violations'})}{t('TR', {ns: 'mri_violations'})}{t('TE', {ns: 'mri_violations'})}{t('TI', {ns: 'mri_violations'})}{t('Slice Thickness', {ns: 'mri_violations'})}{t('Xspace', {ns: 'mri_violations'})}{t('Yspace', {ns: 'mri_violations'})}{t('Zspace', {ns: 'mri_violations'})}{t('Xstep', {ns: 'mri_violations'})}{t('Ystep', {ns: 'mri_violations'})}{t('Zstep', {ns: 'mri_violations'})}{t('Time', {ns: 'mri_violations'})}{t('Image Type', {ns: 'mri_violations'})}{t('Phase Encoding Direction', {ns: 'mri_violations'})}{t('Echo Number', {ns: 'mri_violations'})}
- - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -204,7 +208,7 @@ function ProtocolViolationModal(props) {
Center NameScanner IDScan TypeTR RangeTE RangeTI RangeSlice Thickness RangeXspace RangeYspace RangeZspace RangeXstep RangeYstep RangeZstep RangeTime RangeImage TypePhase Encoding DirectionEcho Number{t('Center Name', {ns: 'mri_violations'})}{t('Scanner ID', {ns: 'mri_violations'})}{t('Scan Type', {ns: 'mri_violations'})}{t('TR Range', {ns: 'mri_violations'})}{t('TE Range', {ns: 'mri_violations'})}{t('TI Range', {ns: 'mri_violations'})}{t('Slice Thickness Range', {ns: 'mri_violations'})}{t('Xspace Range', {ns: 'mri_violations'})}{t('Yspace Range', {ns: 'mri_violations'})}{t('Zspace Range', {ns: 'mri_violations'})}{t('Xstep Range', {ns: 'mri_violations'})}{t('Ystep Range', {ns: 'mri_violations'})}{t('Zstep Range', {ns: 'mri_violations'})}{t('Time Range', {ns: 'mri_violations'})}{t('Image Type', {ns: 'mri_violations'})}{t('Phase Encoding Direction', {ns: 'mri_violations'})}{t('Echo Number', {ns: 'mri_violations'})}
{protocol['ScannerID']} {protocol['ScanType']} - Series Description Regex: + {t('Series Description Regex:', {ns: 'mri_violations'})} {protocol['series_description_regex']} @@ -244,9 +248,9 @@ function ProtocolViolationModal(props) { show={true} width="90%" title={title}> -

Image Protocol

+

{t('Image Protocol', {ns: 'mri_violations'})}

{violations} -

Study Protocols

+

{t('Study Protocols', {ns: 'mri_violations'})}

{protocolgroups} ; } @@ -254,6 +258,7 @@ ProtocolViolationModal.propTypes = { URL: PropTypes.string, SeriesUID: PropTypes.string, onClose: PropTypes.func, + t: PropTypes.func, }; /** @@ -268,6 +273,7 @@ ProtocolViolationModal.propTypes = { */ function ProtocolCheckViolationModal(props) { const [data, setData] = useState([]); + const {t} = props; useEffect(() => { fetch(props.URL + '?format=json' + '&violationtype=protocolcheck' + @@ -286,12 +292,20 @@ function ProtocolCheckViolationModal(props) { return -

Scan Problems

- +

{t('Scan Problems', {ns: 'mri_violations'})}

+ @@ -301,5 +315,7 @@ ProtocolCheckViolationModal.propTypes = { URL: PropTypes.string, SeriesUID: PropTypes.string, onClose: PropTypes.func, + t: PropTypes.func, }; -export default ProtocolModal; + +export default withTranslation(['mri_violations', 'loris'])(ProtocolModal); diff --git a/modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.po b/modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.po new file mode 100644 index 00000000000..38e5baa24af --- /dev/null +++ b/modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.po @@ -0,0 +1,166 @@ +# 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 "MRI Violated Scans" +msgstr "एमआरआई उल्लंघन स्कैन" + +msgid "Violations for SeriesUID" +msgstr "सीरीज़UID के लिए उल्लंघन" + +msgid "Violations for" +msgstr "के लिए उल्लंघन" + +msgid "Time Run" +msgstr "चलने का समय" + +msgid "Series Description" +msgstr "श्रृंखला विवरण" + +msgid "Image Location" +msgstr "छवि स्थान" + +msgid "Patient Name" +msgstr "मरीज़ का नाम" + +msgid "Series UID" +msgstr "श्रृंखला UID" + +msgid "Echo Time" +msgstr "इको समय" + +msgid "Protocol Group" +msgstr "प्रोटोकॉल समूह" + +msgid "TR" +msgstr "टीआर" + +msgid "TE" +msgstr "टीई" + +msgid "TI" +msgstr "टीआई" + +msgid "Slice Thickness" +msgstr "स्लाइस की मोटाई" + +msgid "Xspace" +msgstr "एक्स स्पेस" + +msgid "Yspace" +msgstr "वाई स्पेस" + +msgid "Zspace" +msgstr "ज़ेड स्पेस" + +msgid "Xstep" +msgstr "एक्स स्टेप" + +msgid "Ystep" +msgstr "वाई स्टेप" + +msgid "Zstep" +msgstr "ज़ेड स्टेप" + +msgid "Time" +msgstr "समय" + +msgid "Image Type" +msgstr "छवि प्रकार" + +msgid "Phase Encoding Direction" +msgstr "फेज एन्कोडिंग दिशा" + +msgid "Echo Number" +msgstr "इको संख्या" + +msgid "Image Protocol" +msgstr "छवि प्रोटोकॉल" + +msgid "Study Protocols" +msgstr "अध्ययन प्रोटोकॉल" + +msgid "Scan Problems" +msgstr "स्कैन समस्याएँ" + +msgid "Scan Type" +msgstr "स्कैन प्रकार" + +msgid "Severity" +msgstr "गंभीरता" + +msgid "Header" +msgstr "शीर्षक" + +msgid "Value" +msgstr "मान" + +msgid "Valid Values" +msgstr "मान्य मान" + +msgid "Protocol Violation" +msgstr "प्रोटोकॉल उल्लंघन" + +msgid "Could not identify scan type" +msgstr "स्कैन प्रकार की पहचान नहीं हो सकी" + +msgid "Series Description or Scan Type" +msgstr "श्रृंखला विवरण या स्कैन प्रकार" + +msgid "Resolution Status" +msgstr "समाधान स्थिति" + +msgid "Unresolved" +msgstr "अनसुलझा" + +msgid "Reran" +msgstr "पुनः चलाया गया" + +msgid "emailed site/pending" +msgstr "साइट को ईमेल किया/लंबित" + +msgid "inserted" +msgstr "डाला गया" + +msgid "rejected" +msgstr "अस्वीकृत" + +msgid "Inserted with flag" +msgstr "फ्लैग के साथ डाला गया" + +msgid "other" +msgstr "अन्य" + +msgid "Type of Problem" +msgstr "समस्या का प्रकार" + +msgid "Select Resolution" +msgstr "समाधान चुनें" + +msgid "Image File" +msgstr "छवि फ़ाइल" + +msgid "Must submit data in JSON format" +msgstr "डेटा JSON प्रारूप में जमा करना आवश्यक है" + +msgid "Can not implement filter on a resource type that has no centers." +msgstr "ऐसे संसाधन प्रकार पर फ़िल्टर लागू नहीं किया जा सकता जिसमें कोई केंद्र नहीं हैं।" + +msgid "Can not implement filter on a resource type that has no projects." +msgstr "ऐसे संसाधन प्रकार पर फ़िल्टर लागू नहीं किया जा सकता जिसमें कोई प्रोजेक्ट नहीं हैं।" diff --git a/modules/mri_violations/locale/mri_violations.pot b/modules/mri_violations/locale/mri_violations.pot index bd5bc3cb494..1ee312bc191 100644 --- a/modules/mri_violations/locale/mri_violations.pot +++ b/modules/mri_violations/locale/mri_violations.pot @@ -27,3 +27,146 @@ msgstr "" msgid "Violated scans" msgstr "" +msgid "Violations for SeriesUID" +msgstr "" + +msgid "Violations for" +msgstr "" + +msgid "Time Run" +msgstr "" + +msgid "Series Description" +msgstr "" + +msgid "Image Location" +msgstr "" + +msgid "Patient Name" +msgstr "" + +msgid "Series UID" +msgstr "" + +msgid "Echo Time" +msgstr "" + +msgid "Protocol Group" +msgstr "" + +msgid "TR" +msgstr "" + +msgid "TE" +msgstr "" + +msgid "TI" +msgstr "" + +msgid "Slice Thickness" +msgstr "" + +msgid "Xspace" +msgstr "" + +msgid "Yspace" +msgstr "" + +msgid "Zspace" +msgstr "" + +msgid "Xstep" +msgstr "" + +msgid "Ystep" +msgstr "" + +msgid "Zstep" +msgstr "" + +msgid "Time" +msgstr "" + +msgid "Image Type" +msgstr "" + +msgid "Phase Encoding Direction" +msgstr "" + +msgid "Echo Number" +msgstr "" + +msgid "Image Protocol" +msgstr "" + +msgid "Study Protocols" +msgstr "" + +msgid "Scan Problems" +msgstr "" + +msgid "Scan Type" +msgstr "" + +msgid "Severity" +msgstr "" + +msgid "Header" +msgstr "" + +msgid "Value" +msgstr "" + +msgid "Valid Values" +msgstr "" + +msgid "Protocol Violation" +msgstr "" + +msgid "Could not identify scan type" +msgstr "" + +msgid "Series Description or Scan Type" +msgstr "" + +msgid "Resolution Status" +msgstr "" + +msgid "Unresolved" +msgstr "" + +msgid "Reran" +msgstr "" + +msgid "emailed site/pending" +msgstr "" + +msgid "inserted" +msgstr "" + +msgid "rejected" +msgstr "" + +msgid "Inserted with flag" +msgstr "" + +msgid "other" +msgstr "" + +msgid "Type of Problem" +msgstr "" + +msgid "Select Resolution" +msgstr "" + +msgid "Image File" +msgstr "" + +msgid "Must submit data in JSON format" +msgstr "" + +msgid "Can not implement filter on a resource type that has no centers." +msgstr "" + +msgid "Can not implement filter on a resource type that has no projects." +msgstr "" diff --git a/modules/mri_violations/php/resolve.class.inc b/modules/mri_violations/php/resolve.class.inc index 3264e0fc835..d614a898567 100644 --- a/modules/mri_violations/php/resolve.class.inc +++ b/modules/mri_violations/php/resolve.class.inc @@ -1,8 +1,9 @@ hasAnyPermission( [ @@ -37,17 +38,25 @@ class Resolve extends \NDB_Page * * @return ResponseInterface */ - public function handle(ServerRequestInterface $request) : ResponseInterface + public function handle(ServerRequestInterface $request): ResponseInterface { $user = $request->getAttribute("user"); if (!$this->_hasAccess($user)) { - return new \LORIS\Http\Response\JSON\Forbidden("Access denied"); + return new \LORIS\Http\Response\JSON\Forbidden( + dgettext( + 'loris', + "Access denied" + ) + ); } $requestdata = json_decode((string) $request->getBody(), true); if (!is_array($requestdata)) { return new \LORIS\Http\Response\JSON\BadRequest( - "Must submit data in JSON format" + dgettext( + 'loris', + "Must submit data in JSON format" + ) ); } @@ -80,7 +89,7 @@ class Resolve extends \NDB_Page // Not modified $response = $response->withStatus(304); } - } else if ($val !== 'unresolved') { + } elseif ($val !== 'unresolved') { // no need to insert to DB for Unresolved value. // Base of the insert @@ -154,4 +163,3 @@ class Resolve extends \NDB_Page return $response; } } - diff --git a/modules/mri_violations/php/usercentermatchornull.class.inc b/modules/mri_violations/php/usercentermatchornull.class.inc index 8459e5ee855..8278d7ab6bc 100644 --- a/modules/mri_violations/php/usercentermatchornull.class.inc +++ b/modules/mri_violations/php/usercentermatchornull.class.inc @@ -20,7 +20,7 @@ class UserCenterMatchOrNull implements \LORIS\Data\Filter * * @return bool */ - public function filter(\User $user, \Loris\Data\DataInstance $resource) : bool + public function filter(\User $user, \Loris\Data\DataInstance $resource): bool { // phan only understands method_exists on simple variables. // Assigning to a variable is the a workaround @@ -37,7 +37,10 @@ class UserCenterMatchOrNull implements \LORIS\Data\Filter return true; } throw new \LorisException( - "Can not implement filter on a resource type that has no centers." + dgettext( + 'mri_violations', + "Can not implement filter on a resource type that has no centers." + ) ); } } diff --git a/modules/mri_violations/php/usercentermatchornulloranypermission.class.inc b/modules/mri_violations/php/usercentermatchornulloranypermission.class.inc index 3518a8b0190..a3fbce96899 100644 --- a/modules/mri_violations/php/usercentermatchornulloranypermission.class.inc +++ b/modules/mri_violations/php/usercentermatchornulloranypermission.class.inc @@ -30,7 +30,7 @@ class UserCenterMatchOrNullOrAnyPermission implements \LORIS\Data\Filter * * @return bool */ - public function filter(\User $user, \Loris\Data\DataInstance $resource) : bool + public function filter(\User $user, \Loris\Data\DataInstance $resource): bool { // phan only understands method_exists on simple variables. // Assigning to a variable is the a workaround @@ -51,7 +51,10 @@ class UserCenterMatchOrNullOrAnyPermission implements \LORIS\Data\Filter return true; } throw new \LorisException( - "Can not implement filter on a resource type that has no centers." + dgettext( + 'loris', + "Can not implement filter on a resource type that has no centers." + ) ); } } diff --git a/modules/mri_violations/php/userprojectmatchornull.class.inc b/modules/mri_violations/php/userprojectmatchornull.class.inc index d1699704133..105f65b5571 100644 --- a/modules/mri_violations/php/userprojectmatchornull.class.inc +++ b/modules/mri_violations/php/userprojectmatchornull.class.inc @@ -12,6 +12,7 @@ * @license http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 * @link https://www.github.com/aces/Loris/ */ + namespace LORIS\mri_violations; /** @@ -40,7 +41,7 @@ class UserProjectMatchOrNull implements \LORIS\Data\Filter * * @return bool true if the user has a project in common with the data */ - public function filter(\User $user, \Loris\Data\DataInstance $resource) : bool + public function filter(\User $user, \Loris\Data\DataInstance $resource): bool { // phan only understands method_exists on simple variables. // Assigning to a variable is the a workaround @@ -57,7 +58,10 @@ class UserProjectMatchOrNull implements \LORIS\Data\Filter return true; } throw new \LorisException( - "Can not implement filter on a resource type that has no projects." + dgettext( + 'loris', + "Can not implement filter on a resource type that has no projects." + ) ); } }