Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ locales:
msgfmt -o modules/api_docs/locale/ja/LC_MESSAGES/api_docs.mo modules/api_docs/locale/ja/LC_MESSAGES/api_docs.po
msgfmt -o modules/battery_manager/locale/ja/LC_MESSAGES/battery_manager.mo modules/battery_manager/locale/ja/LC_MESSAGES/battery_manager.po
msgfmt -o modules/behavioural_qc/locale/ja/LC_MESSAGES/behavioural_qc.mo modules/behavioural_qc/locale/ja/LC_MESSAGES/behavioural_qc.po
msgfmt -o modules/behavioural_qc/locale/hi/LC_MESSAGES/behavioural_qc.mo modules/behavioural_qc/locale/hi/LC_MESSAGES/behavioural_qc.po
npx i18next-conv -l hi -s modules/behavioural_qc/locale/hi/LC_MESSAGES/behavioural_qc.po -t modules/behavioural_qc/locale/hi/LC_MESSAGES/behavioural_qc.json
msgfmt -o modules/brainbrowser/locale/ja/LC_MESSAGES/brainbrowser.mo modules/brainbrowser/locale/ja/LC_MESSAGES/brainbrowser.po
msgfmt -o modules/bvl_feedback/locale/ja/LC_MESSAGES/bvl_feedback.mo modules/bvl_feedback/locale/ja/LC_MESSAGES/bvl_feedback.po
msgfmt -o modules/candidate_list/locale/fr/LC_MESSAGES/candidate_list.mo modules/candidate_list/locale/fr/LC_MESSAGES/candidate_list.po
Expand Down Expand Up @@ -218,7 +220,11 @@ server_processes_manager: modules/server_processes_manager/locale/ja/LC_MESSAGES
conflict_resolver:
target=conflict_resolver npm run compile

behavioural_qc:
msgfmt -o modules/behavioural_qc/locale/hi/LC_MESSAGES/behavioural_qc.mo modules/behavioural_qc/locale/hi/LC_MESSAGES/behavioural_qc.po
npx i18next-conv -l hi -s modules/behavioural_qc/locale/hi/LC_MESSAGES/behavioural_qc.po -t modules/behavioural_qc/locale/hi/LC_MESSAGES/behavioural_qc.json
target=behavioural_qc npm run compile
my_preferences: modules/my_preferences/locale/ja/LC_MESSAGES/my_preferences.mo modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.mo
npx i18next-conv -l ja -s modules/my_preferences/locale/ja/LC_MESSAGES/my_preferences.po -t modules/my_preferences/locale/ja/LC_MESSAGES/my_preferences.json --compatibilityJSON v4
npx i18next-conv -l hi -s modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po -t modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.json --compatibilityJSON v4
target=my_preferences npm run compile
target=my_preferences npm run compile
6 changes: 4 additions & 2 deletions locale/hi/LC_MESSAGES/loris.po
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,10 @@ msgstr "प्रगति पर"
msgid "Complete"
msgstr "पूर्ण"

msgid "Instruments"
msgstr "उपकरण"
msgid "Instrument"
msgid_plural "Instruments"
msgstr[0] "उपकरण"
msgstr[1] "उपकरण"

msgid "Partial"
msgstr "आंशिक"
Expand Down
13 changes: 10 additions & 3 deletions modules/behavioural_qc/jsx/behaviouralQCIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import IncompleteForms from './tabs_content/incompleteForms';
import DataConflicts from './tabs_content/dataConflicts';
import BehaviouralFeedback from './tabs_content/behaviouralFeedback';

import hiStrings from '../locale/hi/LC_MESSAGES/behavioural_qc.json';
/**
* Behavioural Quality Control.
*
Expand All @@ -20,10 +21,14 @@ import BehaviouralFeedback from './tabs_content/behaviouralFeedback';
* @version 1.0.0
*/
const BehaviouralQC = (props) => {
const {t} = props;
const tabList = [
{id: 'tabIncompleteForms', label: 'Incomplete Forms'},
{id: 'tabDataConflicts', label: 'Data Conflicts'},
{id: 'tabBehaviouralFeedback', label: 'Behavioural Feedback'},
{id: 'tabIncompleteForms', label: t('Incomplete Forms',
{ns: 'behavioural_qc'})},
{id: 'tabDataConflicts', label: t('Data Conflicts',
{ns: 'behavioural_qc'})},
{id: 'tabBehaviouralFeedback', label: t('Behavioural Feedback',
{ns: 'behavioural_qc'})},
];

/**
Expand All @@ -49,13 +54,15 @@ const BehaviouralQC = (props) => {
};
BehaviouralQC.propTypes = {
baseURL: PropTypes.string.isRequired,
t: PropTypes.func, // ADD THIS
};

/**
* Render Behavioural Quality Control on page load.
*/
window.addEventListener('load', () => {
i18n.addResourceBundle('ja', 'behavioural_qc', {});
i18n.addResourceBundle('hi', 'behavioural_qc', hiStrings);
const Index = withTranslation(
['behavioural_qc', 'loris']
)(BehaviouralQC);
Expand Down
128 changes: 64 additions & 64 deletions modules/behavioural_qc/jsx/tabs_content/behaviouralFeedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Loader from 'jsx/Loader';
import FilterableDataTable from 'jsx/FilterableDataTable';
import {withTranslation} from 'react-i18next';

/**
* Behavioural Feedback Component.
Expand Down Expand Up @@ -80,83 +81,80 @@ class BehaviouralFeedback extends Component {
* @return {*} a formatted table cell for a given column
*/
formatColumn(column, cell, rowData, rowHeaders) {
let reactElement;
switch (column) {
case 'PSCID':
reactElement = (
const {t} = this.props;
const labelPSCID = t('PSCID', {ns: 'loris'});
const labelDCCID = t('DCCID', {ns: 'loris'});
const labelBVL = t('Feedback Level', {ns: 'behavioural_qc'});
const labelInstrument = t('Instrument', {ns: 'loris', count: 1});
const labelTestName = t('Test Name', {ns: 'behavioural_qc'});
const labelVisit = t('Visit', {ns: 'loris'});

// PSCID column (match English or translated)
if (column === 'PSCID' || column === labelPSCID) {
return (
<td>
<a href={this.props.baseURL +
'/' +
rowData['DCCID']
}>
{rowData['PSCID']}
<a
href={this.props.baseURL + '/' + rowData[labelDCCID]}
>
{rowData[labelPSCID]}
</a>
</td>
);
break;
case 'DCCID':
reactElement = (
}

// DCCID column
if (column === 'DCCID' || column === labelDCCID) {
return (
<td>
<a href={this.props.baseURL +
'/' +
rowData['DCCID']
}>
{rowData['DCCID']}
<a href={this.props.baseURL + '/' + rowData[labelDCCID]}>
{rowData[labelDCCID]}
</a>
</td>
);
break;
case 'Feedback Level':
}

// Feedback Level column — build link depending on row data
if (column === 'Feedback Level' || column === labelBVL) {
let bvlLink = '';
let bvlLevel = '';
if (rowData['Instrument']) {
if (rowData[labelInstrument]) {
bvlLink = this.props.baseURL +
'/instruments/' +
rowData['Test Name'] +
'/?candID=' +
rowData['DCCID'] +
'&sessionID=' +
rowData['sessionID'] +
'&commentID=' +
rowData['commentID'];
// Open feedback panel
bvlLink += '&showFeedback=true';
bvlLevel ='Instrument : ' + rowData['Instrument'];
} else if (rowData['Visit']) {
'/instruments/' +
rowData[labelTestName] +
'/?candID=' + rowData[labelDCCID] +
'&sessionID=' + rowData['sessionID'] +
'&commentID=' + rowData['commentID'] +
'&showFeedback=true';
bvlLevel = labelInstrument + ' : '
+ rowData[labelInstrument];
} else if (rowData[labelVisit]) {
bvlLink = this.props.baseURL +
'/instrument_list/' +
'?candID=' +
rowData['DCCID'] +
'&sessionID=' +
rowData['sessionID'];
// Open feedback panel
bvlLink += '&showFeedback=true';
bvlLevel ='Visit : ' + rowData['Visit'];
'/instrument_list/?candID=' + rowData[labelDCCID] +
'&sessionID=' + rowData['sessionID'] +
'&showFeedback=true';
bvlLevel = labelVisit + ' : '
+ rowData[labelVisit];
} else {
bvlLink = this.props.baseURL +
'/' + rowData['DCCID'];
// Open feedback panel
bvlLink += '/?showFeedback=true';
bvlLevel ='Profile : ' + rowData['PSCID'];
bvlLink = this.props.baseURL + '/' + rowData[labelDCCID]
+ '/?showFeedback=true';
bvlLevel = t('Profile', {ns: 'behavioural_qc'}) + ' : '
+ rowData[labelPSCID];
}
reactElement = (
return (
<td>
<a href={bvlLink}>{bvlLevel}</a>
</td>
);
break;
default:
reactElement = (
<td>{cell}</td>
);
}
return reactElement;

return <td>{cell}</td>;
}

/**
* @return {JSX} the feedback form to render.
*/
render() {
const {t} = this.props;
// Waiting for async data to load.
if (!this.state.isLoaded) {
return <Loader/>;
Expand All @@ -167,7 +165,7 @@ class BehaviouralFeedback extends Component {
// The fields configured for display/hide.
let fields = [
{
label: 'Instrument',
label: t('Instrument', {ns: 'loris', count: 1}),
show: false,
filter: {
name: 'Instrument',
Expand All @@ -179,23 +177,23 @@ class BehaviouralFeedback extends Component {
},
},
{
label: 'DCCID',
label: t('DCCID', {ns: 'loris'}),
show: true,
filter: {
name: 'DCCID',
type: 'text',
},
},
{
label: 'PSCID',
label: t('PSCID', {ns: 'loris'}),
show: true,
filter: {
name: 'PSCID',
type: 'text',
},
},
{
label: 'Visit',
label: t('Visit', {ns: 'loris'}),
show: false,
filter: {
name: 'Visit',
Expand All @@ -204,7 +202,7 @@ class BehaviouralFeedback extends Component {
},
},
{
label: 'Project',
label: t('Project', {ns: 'loris', count: 1}),
show: false,
filter: {
name: 'Project',
Expand All @@ -213,7 +211,7 @@ class BehaviouralFeedback extends Component {
},
},
{
label: 'Cohort',
label: t('Cohort', {ns: 'loris', count: 1}),
show: false,
filter: {
name: 'Cohort',
Expand All @@ -222,7 +220,7 @@ class BehaviouralFeedback extends Component {
},
},
{
label: 'Site',
label: t('Site', {ns: 'loris', count: 1}),
show: false,
filter: {
name: 'Site',
Expand All @@ -243,19 +241,19 @@ class BehaviouralFeedback extends Component {
show: false,
},
{
label: 'Feedback Level',
label: t('Feedback Level', {ns: 'behavioural_qc'}),
show: true,
},
{
label: 'Test Name',
label: t('Test Name', {ns: 'behavioural_qc'}),
show: false,
},
{
label: 'Field Name',
label: t('Field Name', {ns: 'behavioural_qc'}),
show: false,
},
{
label: 'Feedback Status',
label: t('Feedback Status', {ns: 'behavioural_qc'}),
show: true,
},
];
Expand All @@ -280,6 +278,8 @@ BehaviouralFeedback.propTypes = {
display: PropTypes.bool,
data: PropTypes.object,
baseURL: PropTypes.string.isRequired,
t: PropTypes.func,
};

export default BehaviouralFeedback;
export default withTranslation(
['behavioural_qc', 'loris'])(BehaviouralFeedback);
Loading
Loading