Skip to content
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ POFILES=locale/fr/LC_MESSAGES/loris.po \
modules/dashboard/locale/fr/LC_MESSAGES/dashboard.po \
modules/dashboard/locale/ja/LC_MESSAGES/dashboard.po \
modules/candidate_parameters/locale/ja/LC_MESSAGES/candidate_parameters.po \
modules/candidate_parameters/locale/es/LC_MESSAGES/candidate_parameters.po \
modules/imaging_browser/locale/fr/LC_MESSAGES/imaging_browser.po \
modules/imaging_browser/locale/ja/LC_MESSAGES/imaging_browser.po \
modules/imaging_browser/locale/hi/LC_MESSAGES/imaging_browser.po \
Expand Down
44 changes: 42 additions & 2 deletions locale/es/LC_MESSAGES/loris.po
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,15 @@ msgstr "Detalles del Punto en el Tiempo %s"
msgid "Yes"
msgstr "Sí"

msgid "True"
msgstr "Cierto"

msgid "No"
msgstr "No"

msgid "False"
msgstr "Falso"

msgid "Create"
msgstr "Crear"

Expand Down Expand Up @@ -160,7 +166,7 @@ msgstr "Exitoso!"

# Common candidate terms
msgid "PSCID"
msgstr "PSCID"
msgstr "SCPID"

msgid "DCCID"
msgstr "CCDID"
Expand Down Expand Up @@ -198,7 +204,10 @@ msgid "Participant Status"
msgstr ""

msgid "DoB"
msgstr ""
msgstr "Fecha de nacimiento"

msgid "DoD"
msgstr "Fecha de defunción"

msgid "Sex"
msgstr "Sexo"
Expand Down Expand Up @@ -355,6 +364,37 @@ msgstr "{{months}} meses"
msgid "{{years}} years old"
msgstr "{{years}} años"

# Other generic terms
msgid "Loading..."
msgstr ""

msgid "Permission denied"
msgstr ""

msgid "Unauthorized"
msgstr ""

msgid "File to upload"
msgstr "Archivo para subir"

msgid "Please make sure files are not larger than {{maxFileSize}}"
msgstr ""

msgid "Submit"
msgstr ""

msgid "Clear"
msgstr ""

msgid "Add"
msgstr ""

msgid "Update"
msgstr "Actualizar"

msgid "Dataset"
msgstr ""

# For react-select <Select> noOptionsMessage prop
msgid "No options"
msgstr ""
6 changes: 6 additions & 0 deletions locale/loris.pot
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ msgstr ""
msgid "DoB"
msgstr ""

msgid "DoD"
msgstr ""

msgid "Sex"
msgstr ""

Expand Down Expand Up @@ -558,6 +561,9 @@ msgstr ""
msgid "Add"
msgstr ""

msgid "Update"
msgstr ""

msgid "Dataset"
msgstr ""

Expand Down
50 changes: 32 additions & 18 deletions modules/candidate_parameters/jsx/CandidateDOB.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React, {Component} from 'react';
import {withTranslation} from 'react-i18next';
import PropTypes from 'prop-types';
import 'I18nSetup';
import Loader from 'Loader';
import swal from 'sweetalert2';
import {
Expand Down Expand Up @@ -77,8 +79,11 @@ class CandidateDOB 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.', {ns: 'loris'})}</h3>
);
}

if (!this.state.isLoaded) {
Expand All @@ -90,7 +95,7 @@ class CandidateDOB extends Component {
let updateButton = null;
if (loris.userHasPermission('candidate_dob_edit')) {
disabled = false;
updateButton = <ButtonElement label='Update' />;
updateButton = <ButtonElement label={t('Update', {ns: 'loris'})}/>;
}
return (
<div className='row'>
Expand All @@ -101,21 +106,25 @@ class CandidateDOB extends Component {
class='col-md-6'
>
<StaticElement
label='PSCID'
label={t('PSCID', {ns: 'loris'})}
text={this.state.data.pscid}
/>
<StaticElement
label='DCCID'
label={t('DCCID', {ns: 'loris'})}
text={this.state.data.candID}
/>
<StaticElement
label='Disclaimer:'
text={'Any changes to the date of birth requires an administrator '
+ 'to run the fix_candidate_age script.'}
label={t('Disclaimer:', {ns: 'candidate_parameters'})}
text={
t('Any changes to the date of birth requires an administrator '
+ 'to run the fix_candidate_age script.',
{ns: 'candidate_parameters'}
)
}
class='form-control-static text-danger bg-danger col-sm-10'
/>
<DateElement
label='Date Of Birth:'
label={t('DoB', {ns: 'loris'})}
name='dob'
dateFormat={dateFormat}
value={this.state.formData.dob}
Expand All @@ -135,6 +144,7 @@ class CandidateDOB extends Component {
* @param {event} e - Form submission event
*/
handleSubmit(e) {
const {t} = this.props;
e.preventDefault();

let today = new Date();
Expand All @@ -147,10 +157,13 @@ class CandidateDOB extends Component {
this.state.formData.dob : null;
if (dob > today) {
swal.fire({
title: 'Error!',
text: 'Date of birth cannot be later than today!',
title: t('Error!', {ns: 'loris'}),
text:
t('Date of birth cannot be later than today!',
{ns: 'candidate_parameters'}
),
type: 'error',
confrimButtonText: 'OK',
confirmButtonText: t('OK', {ns: 'loris'}),
});
return;
}
Expand All @@ -176,20 +189,20 @@ class CandidateDOB extends Component {
.then((resp) => {
if (resp.ok && resp.status === 200) {
swal.fire({
title: 'Success!',
text: 'Date of birth updated!',
title: t('Success!', {ns: 'loris'}),
text: t('Date of birth updated!', {ns: 'candidate_parameters'}),
type: 'success',
confrimButtonText: 'OK',
confirmButtonText: t('OK', {ns: 'loris'}),
});
if (resp.value) {
this.fetchData();
}
} else {
swal.fire({
title: 'Error!',
text: 'Something went wrong.',
title: t('Error!', {ns: 'loris'}),
text: t('Something went wrong.', {ns: 'candidate_parameters'}),
type: 'error',
confrimButtonText: 'OK',
confirmButtonText: t('OK', {ns: 'loris'}),
});
}
})
Expand All @@ -202,5 +215,6 @@ CandidateDOB.propTypes = {
dataURL: PropTypes.string,
tabName: PropTypes.string,
action: PropTypes.string,
t: PropTypes.string.isRequired,
};
export default CandidateDOB;
export default withTranslation(['candidate_parameters', 'loris'])(CandidateDOB);
59 changes: 38 additions & 21 deletions modules/candidate_parameters/jsx/CandidateDOD.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React, {Component} from 'react';
import {withTranslation} from 'react-i18next';
import PropTypes from 'prop-types';
import 'I18nSetup';
import Loader from 'Loader';
import swal from 'sweetalert2';
import {
Expand Down Expand Up @@ -75,8 +77,11 @@ class CandidateDOD 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.', {ns: 'loris'})}</h3>
);
}

if (!this.state.isLoaded) {
Expand All @@ -88,7 +93,7 @@ class CandidateDOD extends Component {
let updateButton = null;
if (loris.userHasPermission('candidate_dod_edit')) {
disabled = false;
updateButton = <ButtonElement label="Update"/>;
updateButton = <ButtonElement label={t('Update', {ns: 'loris'})}/>;
}

return (
Expand All @@ -99,21 +104,25 @@ class CandidateDOD extends Component {
ref='form'
class='col-md-6'>
<StaticElement
label='PSCID'
label={t('PSCID', {ns: 'loris'})}
text={this.state.data.pscid}
/>
<StaticElement
label='DCCID'
label={t('DCCID', {ns: 'loris'})}
text={this.state.data.candID}
/>
<StaticElement
label='Disclaimer:'
text='Any changes to the date of death requires an
administrator to run the fix_candidate_age script.'
label={t('Disclaimer:', {ns: 'candidate_parameters'})}
text={
t('Any changes to the date of death requires an administrator '
+ 'to run the fix_candidate_age script.',
{ns: 'candidate_parameters'}
)
}
class='form-control-static text-danger bg-danger col-sm-10'
/>
<DateElement
label='Date Of Death:'
label={t('Date Of Death:', {ns: 'candidate_parameters'})}
name='dod'
dateFormat={dateFormat}
value={this.state.formData.dod}
Expand All @@ -133,6 +142,7 @@ class CandidateDOD extends Component {
* @param {event} e - Form submission event
*/
handleSubmit(e) {
const {t} = this.props;
e.preventDefault();

let today = new Date();
Expand All @@ -148,20 +158,26 @@ class CandidateDOD extends Component {

if (dod > today) {
swal.fire({
title: 'Invalid date',
text: 'Date of death cannot be later than today!',
title: t('Invalid date', {ns: 'candidate_parameters'}),
text:
t('Date of death cannot be later than today!',
{ns: 'candidate_parameters'}
),
type: 'error',
confirmButtonText: 'OK',
confirmButtonText: t('OK', {ns: 'loris'}),
});
return;
}

if (dob > dod) {
swal.fire({
title: 'Invalid date',
text: 'Date of death must be after date of birth!',
title: t('Invalid date', {ns: 'candidate_parameters'}),
text:
t('Date of death must be after date of birth!',
{ns: 'candidate_parameters'}
),
type: 'error',
confirmButtonText: 'OK',
confirmButtonText: t('OK', {ns: 'loris'}),
});
return;
}
Expand All @@ -188,21 +204,21 @@ class CandidateDOD extends Component {
).then((resp) => resp.text()
).then((result) => {
swal.fire({
title: 'Success!',
text: 'Date of death updated!',
title: t('Success!', {ns: 'loris'}),
text: t('Date of death updated!', {ns: 'candidate_parameters'}),
type: 'success',
confirmButtonText: 'OK',
confirmButtonText: t('OK', {ns: 'loris'}),
});
if (result.value) {
this.fetchData();
}
}).catch((error) => {
console.error(error);
swal.fire({
title: 'Error!',
text: 'Something went wrong.',
title: t('Error!', {ns: 'loris'}),
text: t('Something went wrong.', {ns: 'candidate_parameters'}),
type: 'error',
confirmButtonText: 'OK',
confirmButtonText: t('OK', {ns: 'loris'}),
});
});
}
Expand All @@ -211,5 +227,6 @@ CandidateDOD.propTypes = {
dataURL: PropTypes.string,
tabName: PropTypes.string,
action: PropTypes.string,
t: PropTypes.string.isRequired,
};
export default CandidateDOD;
export default withTranslation(['candidate_parameters', 'loris'])(CandidateDOD);
Loading
Loading