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
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ locales:
npx i18next-conv -l hi -s modules/data_release/locale/hi/LC_MESSAGES/data_release.po -t modules/data_release/locale/hi/LC_MESSAGES/data_release.json
msgfmt -o modules/dicom_archive/locale/ja/LC_MESSAGES/dicom_archive.mo modules/dicom_archive/locale/ja/LC_MESSAGES/dicom_archive.po
msgfmt -o modules/dictionary/locale/ja/LC_MESSAGES/dictionary.mo modules/dictionary/locale/ja/LC_MESSAGES/dictionary.po
msgfmt -o modules/dictionary/locale/hi/LC_MESSAGES/dictionary.mo modules/dictionary/locale/hi/LC_MESSAGES/dictionary.po
npx i18next-conv -l hi -s modules/dictionary/locale/hi/LC_MESSAGES/dictionary.po -t modules/dictionary/locale/hi/LC_MESSAGES/dictionary.json
msgfmt -o modules/document_repository/locale/ja/LC_MESSAGES/document_repository.mo modules/document_repository/locale/ja/LC_MESSAGES/document_repository.po
msgfmt -o modules/dqt/locale/ja/LC_MESSAGES/dqt.mo modules/dqt/locale/ja/LC_MESSAGES/dqt.po
msgfmt -o modules/electrophysiology_browser/locale/ja/LC_MESSAGES/electrophysiology_browser.mo modules/electrophysiology_browser/locale/ja/LC_MESSAGES/electrophysiology_browser.po
Expand Down
15 changes: 15 additions & 0 deletions locale/hi/LC_MESSAGES/loris.po
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ msgstr "प्रशासन"
#: modules/datadict/php/module.class.inc:49
#: modules/data_release/php/module.class.inc:56
#: modules/dictionary/php/module.class.inc:49
msgid "Data Dictionary"
msgstr "डेटा शब्दकोश"

#: modules/document_repository/php/module.class.inc:56
#: modules/instrument_builder/php/module.class.inc:48
#: modules/issue_tracker/php/module.class.inc:54
Expand Down Expand Up @@ -130,12 +133,21 @@ msgstr "दौरे का लेबल"
msgid "Site"
msgstr "साइट"

msgid "Module"
msgstr "मॉड्यूल"

msgid "Project"
msgstr "परियोजना"

msgid "Cohort"
msgstr "समूह"

msgid "Cohorts"
msgstr "समूह"

msgid "Session"
msgstr "सत्र"

msgid "Date of registration"
msgstr "पंजीकरण की तिथि"

Expand All @@ -157,6 +169,9 @@ msgstr "स्कैन"
msgid "Date of Birth"
msgstr "जन्म तिथि"

msgid "Visits"
msgstr "भ्रमण"

msgid "An error occured while loading the page."
msgstr "पृष्ठ लोड करते समय एक त्रुटि हुई।"

Expand Down
15 changes: 15 additions & 0 deletions locale/loris.pot
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ msgstr ""
#: modules/datadict/php/module.class.inc:49
#: modules/data_release/php/module.class.inc:56
#: modules/dictionary/php/module.class.inc:49
msgid "Data Dictionary"
msgstr ""

#: modules/document_repository/php/module.class.inc:56
#: modules/instrument_builder/php/module.class.inc:48
#: modules/issue_tracker/php/module.class.inc:54
Expand Down Expand Up @@ -129,12 +132,21 @@ msgstr ""
msgid "Site"
msgstr ""

msgid "Module"
msgstr ""

msgid "Project"
msgstr ""

msgid "Cohort"
msgstr ""

msgid "Cohorts"
msgstr ""

msgid "Session"
msgstr ""

msgid "Date of registration"
msgstr ""

Expand All @@ -156,6 +168,9 @@ msgstr ""
msgid "Date of Birth"
msgstr ""

msgid "Visits"
msgstr ""

msgid "An error occured while loading the page."
msgstr ""

Expand Down
72 changes: 40 additions & 32 deletions modules/dictionary/jsx/dataDictIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import Loader from 'Loader';
import FilterableDataTable from 'FilterableDataTable';
import swal from 'sweetalert2';

import hiStrings from '../locale/hi/LC_MESSAGES/dictionary.json';

/**
* Data Dictionary Page.
*
Expand Down Expand Up @@ -68,16 +70,17 @@ class DataDictIndex extends Component {
* @return {Function} callback function for react to activate swal
*/
editSwal(row) {
const {t} = this.props;
return () => {
swal.fire({
title: 'Edit Description',
title: t('Edit Description', {ns: 'dictionary'}),
input: 'text',
inputValue: row.Description,
confirmButtonText: 'Modify',
confirmButtonText: t('Modify', {ns: 'dictionary'}),
showCancelButton: true,
inputValidator: (value) => {
if (!value) {
return 'Missing description';
return t('Missing description', {ns: 'dictionary'});
}
},
}).then((result) => {
Expand Down Expand Up @@ -106,7 +109,7 @@ class DataDictIndex extends Component {
// Aggressively update the state and assume
// it's been modified.
this.state.data.Data[i][3] = result.value;
this.state.data.Data[i][4] = 'Modified';
this.state.data.Data[i][4] = t('Modified', {ns: 'dictionary'});

// Force a re-render
this.setState({state: this.state});
Expand Down Expand Up @@ -183,20 +186,21 @@ class DataDictIndex extends Component {
* @return {*} a formatted table cell for a given column
*/
formatColumn(column, cell, rowData, rowHeaders) {
const {t} = this.props;
const hasEditPermission = loris.userHasPermission('data_dict_edit');
let editIcon = '';
let edited='';
let edited = '';
switch (column) {
case 'Description':
case t('Description', {ns: 'dictionary'}):
if (hasEditPermission) {
editIcon = (<i className="fas fa-edit"
style={{cursor: 'pointer'}}
onClick={this.editSwal(rowData)}>
</i>);
}

if (rowData['Description Status'] == 'Modified') {
edited = <span>(edited)</span>;
if (rowData[t('Description Status', {ns: 'dictionary'})] ===
t('Modified', {ns: 'dictionary'})) {
edited = <span>({t('edited', {ns: 'dictionary'})})</span>;
}
return <td>{cell}
<span style={{color: '#838383'}}>{edited} {editIcon} </span>
Expand All @@ -212,8 +216,11 @@ class DataDictIndex extends Component {
* @return {JSX} - React markup for the component
*/
render() {
const {t} = this.props;

if (this.state.error) {
return <h3>An error occured while loading the page.</h3>;
return <h3>{t('An error occured while loading the page.',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is in in the loris namespace

{ns: 'loris'})}</h3>;
}

// Waiting for async data to load
Expand All @@ -224,7 +231,7 @@ class DataDictIndex extends Component {
let options = this.state.data.fieldOptions;
let fields = [
{
label: 'Module',
label: t('Module', {ns: 'loris'}),
show: true,
filter: {
name: 'Module',
Expand All @@ -233,82 +240,82 @@ class DataDictIndex extends Component {
},
},
{
label: 'Category',
label: t('Category', {ns: 'dictionary'}),
show: false,
filter: {
name: 'Category',
type: 'select',
options: this.state.moduleFilter == ''
options: this.state.moduleFilter === ''
? {}
: options.categories[this.state.moduleFilter],
},
},
{
label: 'Field Name',
label: t('Field Name', {ns: 'dictionary'}),
show: true,
filter: {
name: 'Name',
type: 'text',
},
},
{
label: 'Description',
label: t('Description', {ns: 'dictionary'}),
show: true,
filter: {
name: 'Description',
type: 'text',
},
},
{
label: 'Description Status',
label: t('Description Status', {ns: 'dictionary'}),
show: false,
filter: {
name: 'DescriptionStatus',
type: 'select',
options: {
'empty': 'Empty',
'modified': 'Modified',
'unchanged': 'Unchanged',
'empty': t('Empty', {ns: 'dictionary'}),
'modified': t('Modified', {ns: 'dictionary'}),
'unchanged': t('Unchanged', {ns: 'dictionary'}),
},
},
},
{
label: 'Data Scope',
label: t('Data Scope', {ns: 'dictionary'}),
show: true,
filter: {
name: 'datascope',
type: 'select',
options: {
'candidate': 'Candidate',
'session': 'Session',
'project': 'Project',
'candidate': t('Candidate', {ns: 'loris'}),
'session': t('Session', {ns: 'loris'}),
'project': t('Project', {ns: 'loris'}),
},
},
},
{
label: 'Data Type',
label: t('Data Type', {ns: 'dictionary'}),
show: true,
filter: {
name: 'datatype',
type: 'text',
},
},
{
label: 'Data Cardinality',
label: t('Data Cardinality', {ns: 'dictionary'}),
show: true,
filter: {
name: 'cardinality',
type: 'select',
options: {
'unique': 'Unique',
'single': 'Single',
'optional': 'Optional',
'many': 'Many',
'unique': t('Unique', {ns: 'dictionary'}),
'single': t('Single', {ns: 'dictionary'}),
'optional': t('Optional', {ns: 'dictionary'}),
'many': t('Many', {ns: 'dictionary'}),
},
},
},
{
label: 'Visits',
label: t('Visits', {ns: 'loris'}),
show: true,
filter: {
name: 'Visits',
Expand All @@ -317,7 +324,7 @@ class DataDictIndex extends Component {
},
},
{
label: 'Cohorts',
label: t('Cohorts', {ns: 'loris'}),
show: true,
filter: {
name: 'Cohorts',
Expand All @@ -340,10 +347,11 @@ class DataDictIndex extends Component {
DataDictIndex.propTypes = {
dataURL: PropTypes.string.isRequired,
BaseURL: PropTypes.string,
t: PropTypes.func.isRequired,
};

window.addEventListener('load', () => {
i18n.addResourceBundle('ja', 'dictionary', {});
i18n.addResourceBundle('hi', 'dictionary', hiStrings);
const Index = withTranslation(
['dictionary', 'loris']
)(DataDictIndex);
Expand Down
53 changes: 53 additions & 0 deletions modules/dictionary/locale/dictionary.pot
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,56 @@ msgstr ""
msgid "Data Dictionary"
msgstr ""

msgid "Edit Description"
msgstr ""

msgid "Modify"
msgstr ""

msgid "Missing description"
msgstr ""

msgid "Description Status"
msgstr ""

msgid "Modified"
msgstr ""

msgid "edited"
msgstr ""

msgid "Empty"
msgstr ""

msgid "Unchanged"
msgstr ""

msgid "Category"
msgstr ""

msgid "Field Name"
msgstr ""

msgid "Data Scope"
msgstr ""

msgid "Data Type"
msgstr ""

msgid "Data Cardinality"
msgstr ""

msgid "Unique"
msgstr ""

msgid "Single"
msgstr ""

msgid "Optional"
msgstr ""

msgid "Many"
msgstr ""

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this extra empty lines at the end of this file.

msgid "Description"
msgstr ""
Loading
Loading