Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
16 changes: 11 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ check: checkstatic unittests
testdata:
php tools/raisinbread_refresh.php

locales:
locales:
msgfmt -o locale/en/LC_MESSAGES/loris.mo locale/en/LC_MESSAGES/loris.po
npx i18next-conv -l en -s locale/en/LC_MESSAGES/loris.po -t locale/en/LC_MESSAGES/loris.json --compatibilityJSON v4
msgfmt -o locale/fr/LC_MESSAGES/loris.mo locale/fr/LC_MESSAGES/loris.po
Expand Down Expand Up @@ -120,6 +120,9 @@ locales:
npx i18next-conv -l hi -s modules/datadict/locale/hi/LC_MESSAGES/datadict.po -t modules/datadict/locale/hi/LC_MESSAGES/datadict.json
npx i18next-conv -l ja -s modules/datadict/locale/ja/LC_MESSAGES/datadict.po -t modules/datadict/locale/ja/LC_MESSAGES/datadict.json
msgfmt -o modules/dataquery/locale/ja/LC_MESSAGES/dataquery.mo modules/dataquery/locale/ja/LC_MESSAGES/dataquery.po
msgfmt -o modules/dataquery/locale/hi/LC_MESSAGES/dataquery.mo modules/dataquery/locale/hi/LC_MESSAGES/dataquery.po
npx i18next-conv -l ja -s modules/dataquery/locale/ja/LC_MESSAGES/dataquery.po -t modules/dataquery/locale/ja/LC_MESSAGES/dataquery.json
npx i18next-conv -l hi -s modules/dataquery/locale/hi/LC_MESSAGES/dataquery.po -t modules/dataquery/locale/hi/LC_MESSAGES/dataquery.json
msgfmt -o modules/data_release/locale/ja/LC_MESSAGES/data_release.mo modules/data_release/locale/ja/LC_MESSAGES/data_release.po
npx i18next-conv -l ja -s modules/data_release/locale/ja/LC_MESSAGES/data_release.po -t modules/data_release/locale/ja/LC_MESSAGES/data_release.json
msgfmt -o modules/data_release/locale/hi/LC_MESSAGES/data_release.mo modules/data_release/locale/hi/LC_MESSAGES/data_release.po
Expand Down Expand Up @@ -224,14 +227,17 @@ data_release: modules/data_release/locale/hi/LC_MESSAGES/data_release.mo modules
instrument_manager: modules/instrument_manager/locale/ja/LC_MESSAGES/instrument_manager.mo
target=instrument_manager npm run compile

dataquery: modules/dataquery/locale/ja/LC_MESSAGES/dataquery.mo modules/dataquery/locale/ja/LC_MESSAGES/dataquery.mo
msgfmt -o modules/dataquery/locale/ja/LC_MESSAGES/dataquery.mo modules/dataquery/locale/ja/LC_MESSAGES/dataquery.po
msgfmt -o modules/dataquery/locale/hi/LC_MESSAGES/dataquery.mo modules/dataquery/locale/hi/LC_MESSAGES/dataquery.po
npx i18next-conv -l ja -s modules/dataquery/locale/ja/LC_MESSAGES/dataquery.po -t modules/dataquery/locale/ja/LC_MESSAGES/dataquery.json
npx i18next-conv -l hi -s modules/dataquery/locale/hi/LC_MESSAGES/dataquery.po -t modules/dataquery/locale/hi/LC_MESSAGES/dataquery.json
target=dataquery npm run compile

instrument_builder: modules/instrument_builder/locale/ja/LC_MESSAGES/instrument_builder.mo modules/instrument_builder/locale/hi/LC_MESSAGES/instrument_builder.mo
npx i18next-conv -l hi -s modules/instrument_builder/locale/hi/LC_MESSAGES/instrument_builder.po -t modules/instrument_builder/locale/hi/LC_MESSAGES/instrument_builder.json --compatibilityJSON v4
target=instrument_builder npm run compile

dataquery: modules/dataquery/locale/ja/LC_MESSAGES/dataquery.mo
msgfmt -o modules/dataquery/locale/ja/LC_MESSAGES/dataquery.mo modules/dataquery/locale/ja/LC_MESSAGES/dataquery.po
target=dataquery npm run compile

login: modules/login/locale/ja/LC_MESSAGES/login.mo
npx i18next-conv -l ja -s modules/login/locale/ja/LC_MESSAGES/login.po -t modules/login/locale/ja/LC_MESSAGES/login.json --compatibilityJSON v4
target=login npm run compile
Expand Down
16 changes: 8 additions & 8 deletions jsx/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ const Modal = ({
const handleClose = () => {
if (throwWarning) { // Display warning if enabled
Swal.fire({
title: t('Are You Sure?'),
text:
t('Leaving the form will result in the'
+' loss of any information entered.'),
title: t('Are You Sure?', {ns: 'loris'}),
text: t('Leaving the form will result in the loss '
+'of any information entered.',
{ns: 'loris'}),
type: 'warning',
showCancelButton: true,
confirmButtonText: t('Proceed'),
cancelButtonText: t('Cancel'),
confirmButtonText: t('Proceed', {ns: 'loris'}),
cancelButtonText: t('Cancel', {ns: 'loris'}),
}).then((result) => result.value && onClose());
} else {
onClose(); // Close immediately if no warning
Expand Down Expand Up @@ -178,7 +178,7 @@ const Modal = ({
const loader = loading && (
<div style={processStyle}>
<Loader size={20}/>
<h5 className='animate-flicker'>{t('Saving')}</h5>
<h5 className='animate-flicker'>{t('Saving', {ns: 'loris'})}</h5>
</div>
);

Expand All @@ -191,7 +191,7 @@ const Modal = ({
style={{color: 'green', marginBottom: '2px'}}
className='glyphicon glyphicon-ok-circle'
/>
<h5>{t('Success!')}</h5>
<h5>{t('Success!', {ns: 'loris'})}</h5>
</div>
);

Expand Down
11 changes: 10 additions & 1 deletion locale/en/LC_MESSAGES/loris.po
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@ msgstr "No"
msgid "Cancel"
msgstr "Cancel"

msgid "Clear"
msgstr "Clear"

msgid "Submit"
msgstr "Submit"

msgid "Proceed"
msgstr "Proceed"

# Common candidate terms
msgid "PSCID"
msgstr "PSCID"
Expand All @@ -147,7 +156,7 @@ msgid "Cohort"
msgid_plural "Cohorts"
msgstr[0] "Cohort"
msgstr[1] "Cohorts"

msgid "Session"
msgstr "Session"

Expand Down
39 changes: 28 additions & 11 deletions locale/hi/LC_MESSAGES/loris.po
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ msgstr "इमेजिंग"
#: modules/candidate_list/php/module.class.inc:76
#: modules/new_profile/php/module.class.inc:50
msgid "Candidate"
msgstr "उम्मीदवार"
msgid_plural "Candidates"
msgstr[0] "उम्मीदवार"
msgstr[1] "उम्मीदवारों"

#: modules/genomic_browser/php/module.class.inc:53
msgid "Genomics"
Expand Down Expand Up @@ -206,12 +208,27 @@ msgstr "चयनित"
msgid "Cancel"
msgstr "रद्द करें"

msgid "Clear"
msgstr "हटाना"

msgid "Proceed"
msgstr "आगे बढ़ना"

msgid "Success!"
msgstr "सफलता!"

msgid "Close"
msgstr "बंद करें"

msgid "Saving"
msgstr "सहेजा जा रहा है"

msgid "Are You Sure?"
msgstr "क्या आप सुनिश्चित हैं?"

msgid "Leaving the form will result in the loss of any information entered."
msgstr "फॉर्म छोड़ने पर दर्ज की गई सभी जानकारी खो जाएगी।"

# Common candidate terms
msgid "PSCID"
msgstr "पीएससीआईडी"
Expand Down Expand Up @@ -252,7 +269,9 @@ msgid_plural "Cohorts"
msgstr[0] "समूह"

msgid "Session"
msgstr "सत्र"
msgid_plural "Sessions"
msgstr[0] "सत्र"
msgstr[1] "सत्र"

msgid "Date of registration"
msgstr "पंजीकरण की तिथि"
Expand Down Expand Up @@ -504,14 +523,12 @@ msgstr "लोड हो रहा है..."
msgid "Permission denied"
msgstr "अनुमति अस्वीकृत"

msgid "Are You Sure?"
msgstr "क्या आप सुनिश्चित हैं?"

msgid "Leaving the form will result in the loss of any information entered."
msgstr "फ़ॉर्म छोड़ने से दर्ज की गई सभी जानकारी खो जाएगी।"
msgid "and"
msgstr "तथा"

msgid "Proceed"
msgstr "आगे बढ़ें"
msgid "or"
msgstr "वा"

msgid "Saving"
msgstr "सहेजा जा रहा है"
# For react-select <Select> noOptionsMessage prop
msgid "No options"
msgstr "कोई विकल्प नहीं"
29 changes: 27 additions & 2 deletions locale/loris.pot
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ msgstr ""

#: modules/candidate_list/php/module.class.inc:76
#: modules/new_profile/php/module.class.inc:50
#: modules/dataquery/jsx/definefilters.importcsvmodal.tsx:167
msgid "Candidate"
msgstr ""
msgid_plural "Candidates"
msgstr[0] ""

#: modules/genomic_browser/php/module.class.inc:53
msgid "Genomics"
Expand Down Expand Up @@ -194,6 +196,18 @@ msgstr ""
msgid "Close"
msgstr ""

msgid "Saving"
msgstr ""

msgid "Are You Sure?"
msgstr ""

msgid "Leaving the form will result in the loss of any information entered."
msgstr ""

msgid "Close"
msgstr ""

# Common candidate terms
msgid "PSCID"
msgstr ""
Expand Down Expand Up @@ -229,7 +243,8 @@ msgid_plural "Cohorts"
msgstr[0] ""

msgid "Session"
msgstr ""
msgid_plural "Sessions"
msgstr[0] ""

msgid "Date of registration"
msgstr ""
Expand Down Expand Up @@ -518,3 +533,13 @@ msgstr ""

msgid "Permission denied"
msgstr ""

msgid "and"
msgstr ""

msgid "or"
msgstr ""

# For react-select <Select> noOptionsMessage prop
msgid "No options"
msgstr ""
6 changes: 5 additions & 1 deletion modules/dataquery/jsx/components/filterableselectgroup.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Select, {SingleValue} from 'react-select';
import {useTranslation} from 'react-i18next';

type SelectOption = {
label: string,
Expand Down Expand Up @@ -27,8 +28,10 @@ function FilterableSelectGroup(props: {
groups: object,
mapGroupName?: (module: string) => string,
}) {
const {t} = useTranslation();
const groups: SelectGroup[] = [];
const placeholder = props.placeholder || 'Select a category';
const placeholder = props.placeholder ||
t('Select a category', {ns: 'dataquery'});
for (const [module, subcategories]
of Object.entries(props.groups)) {
const options: SelectOption[] = [];
Expand Down Expand Up @@ -71,6 +74,7 @@ function FilterableSelectGroup(props: {
return (
<div>
<Select options={groups} onChange={selected}
noOptionsMessage={() => t('No options', {ns: 'loris'})}
menuPortalTarget={document.body}
styles={{menuPortal:
/**
Expand Down
54 changes: 28 additions & 26 deletions modules/dataquery/jsx/criteriaterm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import FieldDisplay from './fielddisplay';
import {QueryTerm} from './querydef';
import {Operators} from './types';
import {FieldDictionary, FullDictionary} from './types';
import {useTranslation, Trans} from 'react-i18next';

/**
* Convert an operator serialization back to unicode for
Expand All @@ -11,22 +12,23 @@ import {FieldDictionary, FullDictionary} from './types';
* @returns {string} - The frontend value to display for op
*/
function op2str(op: string): string {
const {t} = useTranslation();
switch (op) {
case 'lt': return '<';
case 'lte': return '≤';
case 'eq': return '=';
case 'neq': return '≠';
case 'gte': return '≥';
case 'gt': return '>';
case 'in': return 'in';
case 'startsWith': return 'starts with';
case 'contains': return 'contains';
case 'endsWith': return 'ends with';
case 'isnotnull': return 'has data';
case 'isnull': return 'has no data';
case 'exists': return 'exists';
case 'notexists': return 'does not exist';
case 'numberof': return 'number of';
case 'in': return t('in', {ns: 'dataquery'});
case 'startsWith': return t('starts with', {ns: 'dataquery'});
case 'contains': return t('contains', {ns: 'dataquery'});
case 'endsWith': return t('ends with', {ns: 'dataquery'});
case 'isnotnull': return t('has data', {ns: 'dataquery'});
case 'isnull': return t('has no data', {ns: 'dataquery'});
case 'exists': return t('exists', {ns: 'dataquery'});
case 'notexists': return t('does not exist', {ns: 'dataquery'});
case 'numberof': return t('number of', {ns: 'dataquery'});
default: console.error('Unhandle operator');
return '';
}
Expand Down Expand Up @@ -67,6 +69,7 @@ export function CriteriaTerm(props: {
mapModuleName: (module: string) => string,
mapCategoryName: (module: string, category: string) => string,
}) {
const {t} = useTranslation();
const containerStyle: React.CSSProperties ={
display: 'flex' as const,
flexWrap: 'nowrap' as const,
Expand All @@ -91,22 +94,18 @@ export function CriteriaTerm(props: {

let visits;
if (props.term.visits) {
visits = '';
if (props.term.visits.length == 1) {
visits += props.term.visits[0];
} else {
for (let i = 0; i < props.term.visits.length; i++) {
visits += props.term.visits[i];
if (i == props.term.visits.length-2) {
visits += ' or ';
} else if (i < props.term.visits.length-2) {
visits += ', ';
}
}
let visitList = props.term.visits.slice(0, -1).join(', ');
if (props.term.visits.length > 1) {
visitList += ` ${t('or', {ns: 'loris'})} `;
}
visitList += props.term.visits.at(-1);
visits = <div>
<span style={{fontStyle: 'italic'}}>at visit</span>
<span> {visits}</span>
<Trans
i18nKey="<italic>at visit</italic> {{visits}}"
ns="dataquery"
values={{visits: visitList}}
components={{italic: <i/>}}
/>
</div>;
}

Expand Down Expand Up @@ -140,9 +139,12 @@ export function CriteriaTerm(props: {
paddingLeft: '0.2em',
cursor: 'help',
}}
title={'This field may exist multiple times for a single '
+ dict.scope + ' and must match for *any*'
+ ' of the data points'}
title={
t('This field may exist multiple times for a single '
+ '{{scope}} and must match for *any* of the data points',
{ns: 'dataquery', scope: dict.scope}
)
}
></i>;
}
return (
Expand Down
Loading
Loading