Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions locale/hi/LC_MESSAGES/loris.po
Original file line number Diff line number Diff line change
Expand Up @@ -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}} पंक्तियाँ प्रदर्शित"
Expand Down
7 changes: 7 additions & 0 deletions locale/loris.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down Expand Up @@ -259,3 +265,4 @@ msgstr ""

msgid "In Progress"
msgstr ""

68 changes: 43 additions & 25 deletions modules/mri_violations/jsx/mriViolationsIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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) ?
<ProtocolModal
onClose={() => setViolationModal(false)}
Expand Down Expand Up @@ -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 (
<td>
<a href="#" onClick={
Expand All @@ -120,17 +127,17 @@ function MRIViolationsIndex(props) {
TarchiveID: rowData['TarchiveID'],
CandID: rowData.CandId,
})
}>Protocol Violation</a>
}>{t('Protocol Violation', {ns: 'mri_violations'})}</a>
</td>
);
}

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 (
<td>
Expand Down Expand Up @@ -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',
},
Expand All @@ -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},
];
};

Expand All @@ -348,7 +358,8 @@ function MRIViolationsIndex(props) {
{!isLoaded ?
<Loader/> :
isError ?
<h3>An error occurred while loading the page.</h3> :
<h3>{t('An error occurred while loading the page.',
{ns: 'mri_violations'})}</h3> :
<FilterableDataTable
name="violations"
data={data}
Expand All @@ -368,6 +379,7 @@ MRIViolationsIndex.propTypes = {
ModuleURL: PropTypes.string,
SeriesUID: PropTypes.string,
dataURL: PropTypes.string,
t: PropTypes.func,
};

/**
Expand Down Expand Up @@ -401,10 +413,16 @@ function columnMapper(fieldOptions) {
}

window.addEventListener('load', () => {
i18n.addResourceBundle('hi', 'mri_violations', hiStrings);

const ViolationsIndex = withTranslation(
['mri_violations', 'loris']
)(MRIViolationsIndex);

ReactDOM.createRoot(
document.getElementById('lorisworkspace')
).render(
<MRIViolationsIndex
<ViolationsIndex
ModuleURL={`${loris.BaseURL}/mri_violations/`}
dataURL={`${loris.BaseURL}/mri_violations/?format=json`}
/>,
Expand Down
Loading
Loading