From 18310b9189511e013c6fbc2b04bdfa2aa4a875a2 Mon Sep 17 00:00:00 2001 From: lorisadmin Date: Mon, 27 Oct 2025 02:26:36 +0000 Subject: [PATCH 1/7] first pass. work in progress. --- Makefile | 2 + locale/es/LC_MESSAGES/loris.po | 25 +++++++++++- locale/loris.pot | 21 ++++++++++ .../candidate_parameters/jsx/CandidateDOB.js | 40 ++++++++++--------- .../candidate_parameters/jsx/CandidateInfo.js | 29 ++++++++------ .../jsx/CandidateParameters.js | 30 +++++++++----- .../jsx/ParticipantStatus.js | 30 +++++++++----- .../locale/candidate_parameters.pot | 3 ++ 8 files changed, 129 insertions(+), 51 deletions(-) diff --git a/Makefile b/Makefile index 762b4ea5c29..9a9f5d94123 100755 --- a/Makefile +++ b/Makefile @@ -86,6 +86,8 @@ locales: msgfmt -o modules/candidate_list/locale/hi/LC_MESSAGES/candidate_list.mo modules/candidate_list/locale/hi/LC_MESSAGES/candidate_list.po npx i18next-conv -l hi -s modules/candidate_list/locale/hi/LC_MESSAGES/candidate_list.po -t modules/candidate_list/locale/hi/LC_MESSAGES/candidate_list.json msgfmt -o modules/candidate_parameters/locale/ja/LC_MESSAGES/candidate_parameters.mo modules/candidate_parameters/locale/ja/LC_MESSAGES/candidate_parameters.po + msgfmt -o modules/candidate_parameters/locale/es/LC_MESSAGES/candidate_parameters.mo modules/candidate_parameters/locale/es/LC_MESSAGES/candidate_parameters.po + npx i18next-conv -l es -s modules/candidate_parameters/locale/es/LC_MESSAGES/candidate_parameters.po -t modules/candidate_parameters/locale/es/LC_MESSAGES/candidate_parameters.json msgfmt -o modules/candidate_profile/locale/ja/LC_MESSAGES/candidate_profile.mo modules/candidate_profile/locale/ja/LC_MESSAGES/candidate_profile.po msgfmt -o modules/configuration/locale/ja/LC_MESSAGES/configuration.mo modules/configuration/locale/ja/LC_MESSAGES/configuration.po msgfmt -o modules/configuration/locale/ja/LC_MESSAGES/configuration.mo modules/configuration/locale/ja/LC_MESSAGES/configuration.po diff --git a/locale/es/LC_MESSAGES/loris.po b/locale/es/LC_MESSAGES/loris.po index 9129c5917bb..99316cd70ea 100644 --- a/locale/es/LC_MESSAGES/loris.po +++ b/locale/es/LC_MESSAGES/loris.po @@ -117,9 +117,15 @@ msgstr "Punto en el tiempo" msgid "Yes" msgstr "Sí" +msgid "True" +msgstr "Cierto" + msgid "No" msgstr "No" +msgid "False" +msgstr "Falso" + msgid "Create" msgstr "Crear" @@ -146,6 +152,9 @@ msgid "Hide Advanced Filters" msgstr "Ocultar filtros avanzados" # Common swal labels +msgid "OK" +msgstr "Aceptar" + msgid "Cancel" msgstr "Cancelar" @@ -154,7 +163,7 @@ msgstr "Exitoso!" # Common candidate terms msgid "PSCID" -msgstr "" +msgstr "SCPID" msgid "DCCID" msgstr "CCDID" @@ -192,7 +201,10 @@ msgid "Participant Status" msgstr "" msgid "DoB" -msgstr "" +msgstr "Fecha de nacimiento" + +msgid "DoD" +msgstr "Fecha de defunción" msgid "Sex" msgstr "" @@ -251,6 +263,15 @@ msgstr "Vistas" msgid "NEW" msgstr "Nuevo" +msgid "Update" +msgstr "Actualizar" + +msgid "Update Successful!" +msgstr "Actualización Exitosa!" + +msgid "Failed to update!" +msgstr "Actualización Fallida!" + msgid "Updated" msgstr "Actualizado" diff --git a/locale/loris.pot b/locale/loris.pot index 4af962e9d06..2fc29a5e6a3 100644 --- a/locale/loris.pot +++ b/locale/loris.pot @@ -116,9 +116,15 @@ msgstr "" msgid "Yes" msgstr "" +msgid "True" +msgstr "" + msgid "No" msgstr "" +msgid "False" +msgstr "" + msgid "Create" msgstr "" @@ -145,6 +151,9 @@ msgid "Hide Advanced Filters" msgstr "" # Common swal labels +msgid "OK" +msgstr "" + msgid "Cancel" msgstr "" @@ -192,6 +201,9 @@ msgstr "" msgid "DoB" msgstr "" +msgid "DoD" +msgstr "" + msgid "Sex" msgstr "" @@ -249,6 +261,15 @@ msgstr "" msgid "NEW" msgstr "" +msgid "Update" +msgstr "" + +msgid "Update Successful!" +msgstr "" + +msgid "Failed to update!" +msgstr "" + msgid "Updated" msgstr "" diff --git a/modules/candidate_parameters/jsx/CandidateDOB.js b/modules/candidate_parameters/jsx/CandidateDOB.js index 035cfec6d43..57b7cea5789 100644 --- a/modules/candidate_parameters/jsx/CandidateDOB.js +++ b/modules/candidate_parameters/jsx/CandidateDOB.js @@ -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 { @@ -77,8 +79,9 @@ class CandidateDOB extends Component { * @return {JSX} - React markup for the component */ render() { + const {t} = this.props; if (this.state.error) { - return

An error occured while loading the page.

; + return

{t('An error occured while loading the page.', {ns: 'loris'})}

; } if (!this.state.isLoaded) { @@ -90,7 +93,7 @@ class CandidateDOB extends Component { let updateButton = null; if (loris.userHasPermission('candidate_dob_edit')) { disabled = false; - updateButton = ; + updateButton = ; } return (
@@ -101,21 +104,21 @@ class CandidateDOB extends Component { class='col-md-6' > 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; } @@ -176,20 +180,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'}), }); } }) @@ -203,4 +207,4 @@ CandidateDOB.propTypes = { tabName: PropTypes.string, action: PropTypes.string, }; -export default CandidateDOB; +export default withTranslation(['candidate_parameters', 'loris'])(CandidateDOB); diff --git a/modules/candidate_parameters/jsx/CandidateInfo.js b/modules/candidate_parameters/jsx/CandidateInfo.js index 959c8342b25..8c8501f2505 100644 --- a/modules/candidate_parameters/jsx/CandidateInfo.js +++ b/modules/candidate_parameters/jsx/CandidateInfo.js @@ -1,5 +1,8 @@ import React, {Component} from 'react'; +import {withTranslation} from 'react-i18next'; import PropTypes from 'prop-types'; +import 'I18nSetup'; + import { FormElement, StaticElement, @@ -19,10 +22,11 @@ class CandidateInfo extends Component { */ constructor(props) { super(props); + const {t} = this.props; this.state = { caveatOptions: { - true: 'True', - false: 'False', + true: t('True', {ns: 'loris'}), + false: t('False', {ns: 'loris'}), }, Data: [], formData: {}, @@ -64,7 +68,7 @@ class CandidateInfo extends Component { }, error: function(data, errorCode, errorMsg) { that.setState({ - error: 'An error occurred when loading the form!', + error: t('An error occured while loading the page.', {ns: 'loris'}), }); }, } @@ -113,6 +117,7 @@ class CandidateInfo extends Component { * @return {JSX} - React markup for the component */ render() { + const {t} = this.props; if (!this.state.isLoaded) { if (this.state.error !== undefined) { return ( @@ -129,7 +134,7 @@ class CandidateInfo extends Component { let updateButton = null; if (loris.userHasPermission('candidate_parameter_edit')) { disabled = false; - updateButton = ; + updateButton = ; } let reasonDisabled = true; let reasonRequired = false; @@ -169,7 +174,7 @@ class CandidateInfo extends Component { if (reasonKey !== null) { specifyOther = - Return to timepoint list + {t('Return to timepoint list', {ns: 'candidate_parameters'})}
@@ -137,11 +143,17 @@ CandidateParameters.propTypes = { const args = QueryString.get(document.currentScript.src); window.addEventListener('load', () => { + i18n.addResourceBundle('es', 'candidate_parameters', esStrings); + + const TranslatedCandidateParameters = withTranslation( + ['candidate_parameters', 'loris'] + )(CandidateParameters) + createRoot( document.getElementById('lorisworkspace') ).render(
- diff --git a/modules/candidate_parameters/jsx/ParticipantStatus.js b/modules/candidate_parameters/jsx/ParticipantStatus.js index ff584c20f10..979ba4d5fd0 100644 --- a/modules/candidate_parameters/jsx/ParticipantStatus.js +++ b/modules/candidate_parameters/jsx/ParticipantStatus.js @@ -1,5 +1,8 @@ import React, {Component} from 'react'; +import {withTranslation} from 'react-i18next'; import PropTypes from 'prop-types'; +import 'I18nSetup'; + import { FormElement, StaticElement, @@ -80,7 +83,7 @@ class ParticipantStatus extends Component { error: function(data, errorCode, errorMsg) { that.setState( { - error: 'An error occurred when loading the form!', + error: t('An error occured while loading the page.', {ns: 'loris'}), } ); }, @@ -119,6 +122,7 @@ class ParticipantStatus extends Component { * @return {JSX} - React markup for the component */ render() { + const {t} = this.props; if (!this.state.isLoaded) { if (this.state.error !== undefined) { return ( @@ -133,7 +137,7 @@ class ParticipantStatus extends Component { let updateButton = null; if (loris.userHasPermission('candidate_parameter_edit')) { disabled = false; - updateButton = ; + updateButton = ; } let required = this.state.Data.required; @@ -203,13 +207,13 @@ class ParticipantStatus extends Component { if (this.state.updateResult) { if (this.state.updateResult === 'success') { alertClass = 'alert alert-success text-center'; - alertMessage = 'Update Successful!'; + alertMessage = t('Update Successful!', {ns: 'loris'}); } else if (this.state.updateResult === 'error') { let errorMessage = this.state.errorMessage; alertClass = 'alert alert-danger text-center'; alertMessage = errorMessage ? errorMessage : - 'Failed to update!'; + t('Failed to update!', {ns: 'loris'}); } } @@ -224,10 +228,16 @@ class ParticipantStatus extends Component { ref="form" class="col-md-6" > - - + + Date: Thu, 27 Nov 2025 14:09:11 +0000 Subject: [PATCH 2/7] [multilingual] candidate_parameters update. --- .../candidate_parameters/jsx/CandidateDOD.js | 46 ++-- .../candidate_parameters/jsx/ConsentStatus.js | 111 ++++++--- .../jsx/DiagnosisEvolution.js | 13 +- .../candidate_parameters/jsx/FamilyInfo.js | 35 +-- .../candidate_parameters/jsx/ProbandInfo.js | 41 ++-- .../locale/candidate_parameters.pot | 190 ++++++++++++++- .../es/LC_MESSAGES/candidate_parameters.po | 220 ++++++++++++++++++ 7 files changed, 563 insertions(+), 93 deletions(-) create mode 100644 modules/candidate_parameters/locale/es/LC_MESSAGES/candidate_parameters.po diff --git a/modules/candidate_parameters/jsx/CandidateDOD.js b/modules/candidate_parameters/jsx/CandidateDOD.js index fd86af02acf..6c3f8888813 100644 --- a/modules/candidate_parameters/jsx/CandidateDOD.js +++ b/modules/candidate_parameters/jsx/CandidateDOD.js @@ -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 { @@ -75,8 +77,9 @@ class CandidateDOD extends Component { * @return {JSX} - React markup for the component */ render() { + const {t} = this.props; if (this.state.error) { - return

An error occured while loading the page.

; + return

{t('An error occured while loading the page.', {ns: 'loris'})}

; } if (!this.state.isLoaded) { @@ -88,7 +91,7 @@ class CandidateDOD extends Component { let updateButton = null; if (loris.userHasPermission('candidate_dod_edit')) { disabled = false; - updateButton = ; + updateButton = ; } return ( @@ -99,21 +102,21 @@ class CandidateDOD extends Component { ref='form' class='col-md-6'> 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; } @@ -188,10 +192,10 @@ 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(); @@ -199,10 +203,10 @@ class CandidateDOD extends Component { }).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'}), }); }); } @@ -212,4 +216,4 @@ CandidateDOD.propTypes = { tabName: PropTypes.string, action: PropTypes.string, }; -export default CandidateDOD; +export default withTranslation(['candidate_parameters', 'loris'])(CandidateDOD); diff --git a/modules/candidate_parameters/jsx/ConsentStatus.js b/modules/candidate_parameters/jsx/ConsentStatus.js index 4518701a233..925cd93d803 100644 --- a/modules/candidate_parameters/jsx/ConsentStatus.js +++ b/modules/candidate_parameters/jsx/ConsentStatus.js @@ -1,5 +1,7 @@ import React, {Component} from 'react'; +import {withTranslation} from 'react-i18next'; import PropTypes from 'prop-types'; +import 'I18nSetup'; import swal from 'sweetalert2'; import {VerticalTabs, TabPane} from 'Tabs'; @@ -56,6 +58,7 @@ class ConsentStatus extends Component { * Retrieve data from the provided URL and save it in state */ fetchData() { + const {t} = this.props; $.ajax(this.props.dataURL, { method: 'GET', dataType: 'json', @@ -77,15 +80,16 @@ class ConsentStatus extends Component { if (data.consentStatuses[cStatus] === 'yes' || data.consentStatuses[cStatus] === 'no' ) { + formData[cOptions] = { - yes: 'Yes', - no: 'No', + yes: t('Yes', {ns: 'loris'}), + no: t('No', {ns: 'loris'}), }; } else { formData[cOptions] = { - yes: 'Yes', - no: 'No', - not_applicable: 'Not applicable', + yes: t('Yes', {ns: 'loris'}), + no: t('No', {ns: 'loris'}), + not_applicable: t('N/A', {ns: 'loris'}), }; } } @@ -150,6 +154,7 @@ class ConsentStatus extends Component { * @param {event} e - Form submission event */ handleSubmit(e) { + const {t} = this.props; e.preventDefault(); let myFormData = this.state.formData; let today = new Date(); @@ -176,11 +181,21 @@ class ConsentStatus extends Component { myFormData[consentDate2] : null; if (date1 !== date2) { - alert(label + ' dates do not match!'); + swal.fire({ + title: t('Error!', {ns: 'loris'}), + text: t('{{label}} dates do not match!', {ns: 'candidate_parameters', label: label}), + type: 'error', + confirmButtonText: t('OK', {ns: 'loris'}), + }); return; } if (date1 > today) { - alert(label + ' date cannot be later than today!'); + swal.fire({ + title: t('Error!', {ns: 'loris'}), + text: t('{{label}} date cannot be later than today!', {ns: 'candidate_parameters', label: label}), + type: 'error', + confirmButtonText: t('OK', {ns: 'loris'}), + }); return; } @@ -193,21 +208,30 @@ class ConsentStatus extends Component { myFormData[consentWithdrawal2] : null; if (withdrawDate1 !== withdrawDate2) { - alert(label + ' withdrawal dates do not match!'); + swal.fire({ + title: t('Error!', {ns: 'loris'}), + text: t('{{label}} withdrawal dates do not match!', {ns: 'candidate_parameters', label: label}), + type: 'error', + confirmButtonText: t('OK', {ns: 'loris'}), + }); return; } if (withdrawDate1 > today) { - alert( - label - + ' withdrawal date cannot be later than today!' - ); + swal.fire({ + title: t('Error!', {ns: 'loris'}), + text: t('{{label}} withdrawal date cannot be later than today!', {ns: 'candidate_parameters', label: label}), + type: 'error', + confirmButtonText: t('OK', {ns: 'loris'}), + }); return; } if (withdrawDate1 < date1) { - alert( - label - + ' withdrawal date cannot be earlier than response date!' - ); + swal.fire({ + title: t('Error!', {ns: 'loris'}), + text: t('{{label}} withdrawal date cannot be earlier than response date!', {ns: 'candidate_parameters', label: label}), + type: 'error', + confirmButtonText: t('OK', {ns: 'loris'}), + }); return; } } @@ -234,7 +258,12 @@ class ConsentStatus extends Component { contentType: false, processData: false, success: (data) => { - swal.fire('Success!', 'Update successful.', 'success') + swal.fire({ + title: t('Success!', {ns: 'loris'}), + text: t('Update successful.', {ns: 'candidate_parameters'}), + type: 'success', + confirmButtonText: t('OK', {ns: 'loris'}), + }) .then((result) => { if (result.value) { this.setState({submitDisabled: false}); @@ -248,8 +277,13 @@ class ConsentStatus extends Component { console.error(error); // Enable submit button for form resubmission this.setState({submitDisabled: false}); - let errorMessage = error.responseText || 'Update failed.'; - swal.fire('Error!', errorMessage, 'error'); + let errorMessage = error.responseText || t('Failed to update!', {ns: 'candidate_parameters'}); + swal.fire({ + title: t('Error!', {ns: 'loris'}), + text: errorMessage, + type: 'error', + confirmButtonText: t('OK', {ns: 'loris'}), + }); }, }); } @@ -267,9 +301,9 @@ class ConsentStatus extends Component { * @return {JSX} - React markup for the component */ renderFormattedHistory() { + const {t} = this.props; const historyBtnLabel = this.state.showHistory ? - 'Hide Consent History' : 'Show Consent History'; - + t('Hide Consent History', {ns: 'candidate_parameters'}) : t('Show Consent History', {ns: 'candidate_parameters'}); const formattedHistory = this.state.Data.history.map((info, key) => { const label = info.label; const dataEntry = info.data_entry_date; @@ -279,23 +313,26 @@ class ConsentStatus extends Component { const withdrawal = info.withdrawal; const dateHistory = consentDate ? ( - , Date of Consent to {consentDate} + + , {t('Date of Consent to {{consentDate}}', {ns: 'candidate_parameters', consentDate: consentDate})} + ) : null; const withdrawalHistory = withdrawal ? ( - , Date of Consent Withdrawal to {withdrawal} + , {t('Date of Consent Withdrawal to {{withdrawal}}', {ns: 'candidate_parameters', withdrawal: withdrawal})} ) : null; - +{t('Date of Consent to {{consentDate}}', {ns: 'candidate_parameters', consentDate: consentDate})} return (

{dataEntry} - {user} - updated for {label}: - Status to {' '} + + {t('updated for {{label}}:', {ns: 'candidate_parameters', label: label})} + {t('Status to ', {ns: 'candidate_parameters'})} {consentStatus} {dateHistory} {withdrawalHistory} @@ -329,6 +366,7 @@ class ConsentStatus extends Component { * @return {JSX} - React markup for the component */ renderConsent(consentName) { + const {t} = this.props; // Allow editing if user has permission let disabled = loris.userHasPermission('candidate_parameter_edit') ? false : true; @@ -366,16 +404,16 @@ class ConsentStatus extends Component { // Set up elements const label = this.state.Data.consents[consentName]; const consentOptions = consentName + '_options'; - const statusLabel = 'Response'; + const statusLabel = t('Response', {ns: 'candidate_parameters'}); const consentDate = consentName + '_date'; const consentDate2 = consentName + '_date2'; - const consentDateLabel = 'Date of Response'; - const consentDateConfirmationLabel = 'Confirmation Date of Response'; + const consentDateLabel = t('Date of Response', {ns: 'candidate_parameters'}); + const consentDateConfirmationLabel = t('Confirmation Date of Response', {ns: 'candidate_parameters'}); const consentWithdrawal = consentName + '_withdrawal'; const consentWithdrawal2 = consentName + '_withdrawal2'; - const consentWithdrawalLabel = 'Date of Withdrawal of Consent'; + const consentWithdrawalLabel = t('Date of Withdrawal of Consent', {ns: 'candidate_parameters'}); const consentWithdrawalConfirmationLabel = - 'Confirmation Date of Withdrawal of Consent'; + t('Confirmation Date of Withdrawal of Consent', {ns: 'candidate_parameters'}); return (

@@ -434,10 +472,11 @@ class ConsentStatus extends Component { * @return {JSX} - React markup for the component */ render() { + const {t} = this.props; // If error occurs, return a message. // XXX: Replace this with a UI component for 500 errors. if (this.state.error) { - return

An error occurred while loading the page.

; + return

{t('An error occured while loading the page.', {ns: 'loris'})}

; } if (!this.state.isLoaded) { @@ -447,7 +486,7 @@ class ConsentStatus extends Component { // Allow editing if user has permission let updateButton = loris.userHasPermission('candidate_parameter_edit') ? () : null; @@ -468,11 +507,11 @@ class ConsentStatus extends Component { class="col-md-9" > {this.state.Data.consentGroups[consentID].Children @@ -508,4 +547,4 @@ ConsentStatus.propTypes = { tabName: PropTypes.string, }; -export default ConsentStatus; +export default withTranslation(['candidate_parameters', 'loris'])(ConsentStatus); diff --git a/modules/candidate_parameters/jsx/DiagnosisEvolution.js b/modules/candidate_parameters/jsx/DiagnosisEvolution.js index 28b1311c4c7..be9afbb7716 100644 --- a/modules/candidate_parameters/jsx/DiagnosisEvolution.js +++ b/modules/candidate_parameters/jsx/DiagnosisEvolution.js @@ -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 StaticDataTable from 'jsx/StaticDataTable'; import { @@ -143,8 +145,9 @@ class DiagnosisEvolution extends Component { * @return {JSX} - React markup for the component */ render() { + const {t} = this.props; if (this.state.error) { - return

An error occured while loading the page.

; + return

{t('An error occured while loading the page.', {ns: 'loris'})}

; } if (!this.state.isLoaded) { @@ -212,16 +215,16 @@ class DiagnosisEvolution extends Component { class='col-md-12' > {latestDiagnosis} {latestConfirmedDiagnosis} -

Diagnosis Evolution

+

{t('Diagnosis Evolution', {ns: 'candidate_parameters'})}

); } - let relationshipOptions = { - 'full_sibling': 'Full Sibling', - 'half_sibling': 'Half Sibling', - '1st_cousin': 'First Cousin', + 'full_sibling': t('Full Sibling', {ns: 'candidate_parameters'}), + 'half_sibling': t('Half Sibling', {ns: 'candidate_parameters'}), + '1st_cousin': t('First Cousin', {ns: 'candidate_parameters'}), }; let disabled = true; let addButton = null; if (loris.userHasPermission('candidate_parameter_edit')) { disabled = false; - addButton = ; + addButton = ; } let candidateList = this.state.Data.candidates; @@ -154,15 +156,16 @@ class FamilyInfo extends Component { familyMembersHTML.push(
{candID}} /> +
{familyMembersHTML} { this.setState({ - error: 'An error occurred when loading the form!', + error: t('An error occurred when loading the form!', {ns: 'candidate_parameters'}), }); }, }); @@ -101,6 +104,7 @@ class ProbandInfo extends Component { * @param {event} e - Form submission event */ handleSubmit(e) { + const {t} = this.props; e.preventDefault(); let myFormData = this.state.formData; let today = new Date(); @@ -119,12 +123,22 @@ class ProbandInfo extends Component { let dob2 = myFormData.ProbandDoB2 ? myFormData.ProbandDoB2 : null; if (dob1 !== dob2) { - alert('DOB do not match!'); + swal.fire({ + title: t('Error!', {ns: 'loris'}), + text: t('DOB do not match!', {ns: 'candidate_parameters'}), + type: 'error', + confirmButtonText: t('OK', {ns: 'loris'}), + }); return; } if (dob1 > today) { - alert('Proband date of birth cannot be later than today!'); + swal.fire({ + title: t('Error!', {ns: 'loris'}), + text: t('Proband date of birth cannot be later than today!', {ns: 'candidate_parameters'}), + type: 'error', + confirmButtonText: t('OK', {ns: 'loris'}), + }); return; } @@ -190,6 +204,7 @@ class ProbandInfo extends Component { * @return {JSX} - React markup for the component */ render() { + const {t} = this.props; if (!this.state.isLoaded) { return ; } @@ -198,7 +213,7 @@ class ProbandInfo extends Component { let updateButton = null; if (loris.userHasPermission('candidate_parameter_edit')) { disabled = false; - updateButton = ; + updateButton = ; } let dobRequired = false; @@ -278,11 +293,11 @@ class ProbandInfo extends Component { if (this.state.updateResult) { if (this.state.updateResult === 'success') { alertClass = 'alert alert-success text-center'; - alertMessage = 'Update Successful!'; + alertMessage = t('Update Successful!', {ns: 'candidate_parameters'}); } else if (this.state.updateResult === 'error') { let errorMessage = this.state.errorMessage; alertClass = 'alert alert-danger text-center'; - alertMessage = errorMessage ? errorMessage : 'Failed to update!'; + alertMessage = errorMessage ? errorMessage : t('Failed to update!', {ns: 'candidate_parameters'}); } } @@ -298,15 +313,15 @@ class ProbandInfo extends Component { class="col-md-6" > {extraParameterFields} @@ -351,4 +366,4 @@ ProbandInfo.propTypes = { tabName: PropTypes.string, }; -export default ProbandInfo; +export default withTranslation(['candidate_parameters', 'loris'])(ProbandInfo); diff --git a/modules/candidate_parameters/locale/candidate_parameters.pot b/modules/candidate_parameters/locale/candidate_parameters.pot index 37e34427923..71e9687dc46 100644 --- a/modules/candidate_parameters/locale/candidate_parameters.pot +++ b/modules/candidate_parameters/locale/candidate_parameters.pot @@ -24,11 +24,197 @@ msgstr "" msgid "Caveat" msgstr "" +msgid "Return to timepoint list" +msgstr "" + +# tabs msgid "Candidate Information" msgstr "" -msgid "Consent Summary" +msgid "Participant Status" +msgstr "" + +msgid "Diagnosis Evolution" +msgstr "" + +msgid "Proband Information" +msgstr "" + +msgid "Family Information" +msgstr "" + +msgid "Consent Status" +msgstr "" + +# Candidate Information tab +msgid "Caveat Emptor Flag for Candidate" +msgstr "" + +msgid "Reason for Caveat Emptor Flag" +msgstr "" + +msgid "If Other, please specify" +msgstr "" + +# Participant Status tab +msgid "Specify Reason" +msgstr "" + +msgid "Comments" +msgstr "" + +# DoB tab +msgid "Disclaimer:" +msgstr "" + +msgid "Any changes to the date of birth requires an administrator to run the fix_candidate_age script." +msgstr "" + +msgid "Date of birth cannot be later than today!" +msgstr "" + +msgid "Date of birth updated!" +msgstr "" + +msgid "Something went wrong." +msgstr "" + +# DoD tab +msgid "Any changes to the date of death requires an administrator to run the fix_candidate_age script." +msgstr "" + +msgid "Date Of Death:" +msgstr "" + +msgid "Invalid date" +msgstr "" + +msgid "Date of death cannot be later than today!" +msgstr "" + +msgid "Date of death must be after date of birth!" +msgstr "" + +msgid "Date of death updated!" +msgstr "" + +# Diagnosis Evolution tab +msgid "Trajectory Name" +msgstr "" + +msgid "Configured Order" +msgstr "" + +msgid "Source Fields" +msgstr "" + +msgid "Diagnosis" +msgstr "" + +msgid "Confirmed" +msgstr "" + +msgid "Last Update" +msgstr "" + +# ProbandInfo Evolution tab +msgid "'An error occurred when loading the form!'" +msgstr "" + +msgid "DOB do not match!" +msgstr "" + +msgid "Proband date of birth cannot be later than today!" +msgstr "" + +msgid "Update Successful!" +msgstr "" + +msgid "Failed to update!" +msgstr "" + +msgid "Proband Sex" +msgstr "" + +msgid "DoB Proband" +msgstr "" + +msgid "Confirm DoB Proband" +msgstr "" + +msgid "Age Difference (months)" +msgstr "" + +# FamilyInfo tab +msgid "Add" +msgstr "" + +msgid "Family Member ID (DCCID)" +msgstr "" + +msgid "Relation Type" +msgstr "" + +msgid "Full Sibling" +msgstr "" + +msgid "Half Sibling" +msgstr "" + +msgid "First Cousin" +msgstr "" + +msgid "Delete" +msgstr "" + +# ConsentStatus tab +msgid "Response" +msgstr "" + +msgid "Date of Response" +msgstr "" + +msgid "Confirmation Date of Response" +msgstr "" + +msgid "Date of Withdrawal of Consent" +msgstr "" + +msgid "Confirmation Date of Withdrawal of Consent" +msgstr "" + +msgid "Update successful." +msgstr "" + +msgid "{{label}} dates do not match!" +msgstr "" + +msgid "{{label}} date cannot be later than today!" +msgstr "" + +msgid "{{label}} withdrawal dates do not match!" +msgstr "" + +msgid "{{label}} withdrawal date cannot be later than today!" +msgstr "" + +msgid "{{label}} withdrawal date cannot be earlier than response date!" +msgstr "" + +msgid "Hide Consent History" +msgstr "" + +msgid "Show Consent History" +msgstr "" + +msgid "Date of Consent to {{consentDate}}" +msgstr "" + +msgid "Date of Consent Withdrawal to {{withdrawal}}" +msgstr "" + +msgid "updated for {{label}}:" msgstr "" -msgid "Consent Type" +msgid "Status to " msgstr "" diff --git a/modules/candidate_parameters/locale/es/LC_MESSAGES/candidate_parameters.po b/modules/candidate_parameters/locale/es/LC_MESSAGES/candidate_parameters.po new file mode 100644 index 00000000000..5ee48466be2 --- /dev/null +++ b/modules/candidate_parameters/locale/es/LC_MESSAGES/candidate_parameters.po @@ -0,0 +1,220 @@ +# Default LORIS strings to be translated (English). +# Copy this to a language specific file and add translations to the +# new file. +# Copyright (C) 2025 +# This file is distributed under the same license as the LORIS package. +# Dave MacFarlane , 2025. +# +msgid "" +msgstr "" +"Project-Id-Version: LORIS 27\n" +"Report-Msgid-Bugs-To: https://github.com/aces/Loris/issues\n" +"POT-Creation-Date: 2025-04-08 14:37-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "Candidate Parameters" +msgstr "Parámetros del Candidato" + +msgid "Caveat" +msgstr "Advertencia" + +msgid "Return to timepoint list" +msgstr "Volver a la lista the Puntos en el Tiempo" + +# tabs +msgid "Candidate Information" +msgstr "Información del Candidato" + +msgid "Participant Status" +msgstr "Estado del Participante" + +msgid "Diagnosis Evolution" +msgstr "Evolución del Diagnóstico" + +msgid "Proband Information" +msgstr "Información de la Probanda" + +msgid "Family Information" +msgstr "Información Familiar" + +msgid "Consent Status" +msgstr "Estado del consentimiento" + +# Candidate Information tab +msgid "Caveat Emptor Flag for Candidate" +msgstr "Alerta sobre el Candidato" + +msgid "Reason for Caveat Emptor Flag" +msgstr "Razón de la Alerta sobre el Candidato" + +msgid "If Other, please specify" +msgstr "Si otra, por favor especifique" + +# Participant Status tab +msgid "Specify Reason" +msgstr "Especifique la razón" + +msgid "Comments" +msgstr "Comentarios" + +# DoB tab +msgid "Disclaimer:" +msgstr "Descargo de responsabilidad:" + +msgid "Any changes to the date of birth requires an administrator to run the fix_candidate_age script." +msgstr "Todo cambio en la Fecha de Nacimiento requiere que un administrador corra el script fix_candidate_age." + +msgid "Date of birth cannot be later than today!" +msgstr "La Fecha de Nacimiento no puede ser posterior al día de hoy!" + +msgid "Date of birth updated!" +msgstr "Fecha de Nacimiento actualizada!" + +msgid "Something went wrong." +msgstr "Algo salió mal." + +# DoD tab +msgid "Any changes to the date of death requires an administrator to run the fix_candidate_age script." +msgstr "Todo cambio en la Fecha de Defunción requiere que un administrador corra el script fix_candidate_age." + +msgid "Date Of Death:" +msgstr "Fecha de Defunción" + +msgid "Invalid date" +msgstr "Fecha no válida" + +msgid "Date of death cannot be later than today!" +msgstr "La fecha de fallecimiento no puder ser major que la fecha de hoy en día!" + +msgid "Date of death must be after date of birth!" +msgstr "La fecha de fallecimiento debe ser posterior a la fecha de nacimiento!" + +msgid "Date of death updated!" +msgstr "Fecha de fallecimiento actualizada!" + +# Diagnosis Evolution tab +msgid "Trajectory Name" +msgstr "Nombre de la trajectoria" + +msgid "Configured Order" +msgstr "Orden configurado" + +msgid "Source Fields" +msgstr "Campos Fuente" + +msgid "Diagnosis" +msgstr "Diagnóstico" + +msgid "Confirmed" +msgstr "Confirmado" + +msgid "Last Update" +msgstr "Última actualización" + +# ProbandInfo Evolution tab +msgid "An error occurred when loading the form!" +msgstr "Un error ocurrió mientras se cargaba el formulario!" + +msgid "DOB do not match!" +msgstr "Las fechas de nacimiento no son iguales!" + +msgid "Proband date of birth cannot be later than today!" +msgstr "La fecha de nacimiento de la Probanda no puede ser posterior a hoy!" + +msgid "Update Successful!" +msgstr "Actualización exitosa!" + +msgid "Failed to update!" +msgstr "Actualización fallida!" + +msgid "Proband Sex" +msgstr "Sexo del probanda" + +msgid "DoB Proband" +msgstr "Fecha de nacimiento del probanda" + +msgid "Confirm DoB Proband" +msgstr "Confirme la fecha de nacimiento del probanda" + +msgid "Age Difference (months)" +msgstr "Diferencia de Edad (meses)" + +# FamilyInfo tab +msgid "Add" +msgstr "Adicionar" + +msgid "Family Member ID (DCCID)" +msgstr "Identificador del miembro Familiar (CCDID)" + +msgid "Relation Type" +msgstr "Tipo de relación" + +msgid "Full Sibling" +msgstr "Hermano" + +msgid "Half Sibling" +msgstr "Medio hermano" + +msgid "First Cousin" +msgstr "Primo hermano" + +msgid "Delete" +msgstr "Borrar" + +# ConsentStatus tab +msgid "Response" +msgstr "Respuesta" + +msgid "Date of Response" +msgstr "Fecha de la respuesta" + +msgid "Confirmation Date of Response" +msgstr "Confirmación de la Fecha de la respuesta" + +msgid "Date of Withdrawal of Consent" +msgstr "Fecha de revocación del consentimiento" + +msgid "Confirmation Date of Withdrawal of Consent" +msgstr "Confirmación de la Fecha de revocación del consentimiento" + +msgid "Update successful." +msgstr "Actualización exitosa." + +msgid "{{label}} dates do not match!" +msgstr "Las fechas en {{label}} no coinciden!" + +msgid "{{label}} date cannot be later than today!" +msgstr "La fecha en {{label}} no puede ser posterior a hoy!" + +msgid "{{label}} withdrawal dates do not match!" +msgstr "Las fechas de revocación de {{label}} no coinciden!" + +msgid "{{label}} withdrawal date cannot be later than today!" +msgstr "La fecha de revocación de {{label}} no puede ser posterior a hoy!" + +msgid "{{label}} withdrawal date cannot be earlier than response date!" +msgstr "La fecha de revocación de {{label}} no puede ser anterior a la fecha del consentimiento!" + +msgid "Hide Consent History" +msgstr "Ocultar Histórico de Consentimiento" + +msgid "Show Consent History" +msgstr "Mostrar Histórico de Consentimiento" + +msgid "Date of Consent to {{consentDate}}" +msgstr "Fecha del consentimiento a {{consentDate}}" + +msgid "Date of Consent Withdrawal to {{withdrawal}}" +msgstr "Fecha de la revocación del consentimiento a {{withdrawal}}" + +msgid "updated for {{label}}:" +msgstr "actualizado para {{label}}:" + +msgid "Status to " +msgstr "Estado a " From 19fd7ba42774dc90fb921ba8ea46088d39822518 Mon Sep 17 00:00:00 2001 From: lorisadmin Date: Thu, 27 Nov 2025 15:24:51 +0000 Subject: [PATCH 3/7] test fix code standars in CandidateDOB --- .../candidate_parameters/jsx/CandidateDOB.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/modules/candidate_parameters/jsx/CandidateDOB.js b/modules/candidate_parameters/jsx/CandidateDOB.js index 57b7cea5789..dfd6de91986 100644 --- a/modules/candidate_parameters/jsx/CandidateDOB.js +++ b/modules/candidate_parameters/jsx/CandidateDOB.js @@ -81,7 +81,10 @@ class CandidateDOB extends Component { render() { const {t} = this.props; if (this.state.error) { - return

{t('An error occured while loading the page.', {ns: 'loris'})}

; + return +

+ {t('An error occured while loading the page.', {ns: 'loris'})} +

; } if (!this.state.isLoaded) { @@ -113,8 +116,11 @@ class CandidateDOB extends Component { /> today) { swal.fire({ title: t('Error!', {ns: 'loris'}), - text: t('Date of birth cannot be later than today!', {ns: 'candidate_parameters'}), + text: t('Date of birth cannot be later than today!', + {ns: 'candidate_parameters'} + ), type: 'error', confirmButtonText: t('OK', {ns: 'loris'}), }); @@ -206,5 +214,6 @@ CandidateDOB.propTypes = { dataURL: PropTypes.string, tabName: PropTypes.string, action: PropTypes.string, + t: PropTypes.string.isRequired, }; export default withTranslation(['candidate_parameters', 'loris'])(CandidateDOB); From 5499ceb214f0d917213ecbf26d627c494a39cf33 Mon Sep 17 00:00:00 2001 From: lorisadmin Date: Thu, 27 Nov 2025 18:48:10 +0000 Subject: [PATCH 4/7] lint. --- .../candidate_parameters/jsx/CandidateDOB.js | 19 ++--- .../candidate_parameters/jsx/CandidateDOD.js | 23 ++++-- .../candidate_parameters/jsx/CandidateInfo.js | 21 +++-- .../jsx/CandidateParameters.js | 5 +- .../candidate_parameters/jsx/ConsentStatus.js | 81 +++++++++++++------ .../jsx/DiagnosisEvolution.js | 9 ++- .../candidate_parameters/jsx/FamilyInfo.js | 16 +++- .../jsx/ParticipantStatus.js | 10 ++- .../candidate_parameters/jsx/ProbandInfo.js | 14 +++- 9 files changed, 142 insertions(+), 56 deletions(-) diff --git a/modules/candidate_parameters/jsx/CandidateDOB.js b/modules/candidate_parameters/jsx/CandidateDOB.js index dfd6de91986..c014f16524d 100644 --- a/modules/candidate_parameters/jsx/CandidateDOB.js +++ b/modules/candidate_parameters/jsx/CandidateDOB.js @@ -81,10 +81,9 @@ class CandidateDOB extends Component { render() { const {t} = this.props; if (this.state.error) { - return -

- {t('An error occured while loading the page.', {ns: 'loris'})} -

; + return ( +

{t('An error occured while loading the page.', {ns: 'loris'})}

+ ); } if (!this.state.isLoaded) { @@ -118,9 +117,10 @@ class CandidateDOB extends Component { 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.', + + 'to run the fix_candidate_age script.', {ns: 'candidate_parameters'} - )} + ) + } class='form-control-static text-danger bg-danger col-sm-10' /> today) { swal.fire({ title: t('Error!', {ns: 'loris'}), - text: t('Date of birth cannot be later than today!', - {ns: 'candidate_parameters'} - ), + text: + t('Date of birth cannot be later than today!', + {ns: 'candidate_parameters'} + ), type: 'error', confirmButtonText: t('OK', {ns: 'loris'}), }); diff --git a/modules/candidate_parameters/jsx/CandidateDOD.js b/modules/candidate_parameters/jsx/CandidateDOD.js index 6c3f8888813..53e3d260b40 100644 --- a/modules/candidate_parameters/jsx/CandidateDOD.js +++ b/modules/candidate_parameters/jsx/CandidateDOD.js @@ -79,7 +79,9 @@ class CandidateDOD extends Component { render() { const {t} = this.props; if (this.state.error) { - return

{t('An error occured while loading the page.', {ns: 'loris'})}

; + return ( +

{t('An error occured while loading the page.', {ns: 'loris'})}

+ ); } if (!this.state.isLoaded) { @@ -111,8 +113,12 @@ class CandidateDOD extends Component { /> today) { swal.fire({ title: t('Invalid date', {ns: 'candidate_parameters'}), - text: t('Date of death cannot be later than today!', {ns: 'candidate_parameters'}), + text: + t('Date of death cannot be later than today!', + {ns: 'candidate_parameters'} + ), type: 'error', confirmButtonText: t('OK', {ns: 'loris'}), }); @@ -163,7 +172,10 @@ class CandidateDOD extends Component { if (dob > dod) { swal.fire({ title: t('Invalid date', {ns: 'candidate_parameters'}), - text: t('Date of death must be after date of birth!', {ns: 'candidate_parameters'}), + text: + t('Date of death must be after date of birth!', + {ns: 'candidate_parameters'} + ), type: 'error', confirmButtonText: t('OK', {ns: 'loris'}), }); @@ -215,5 +227,6 @@ CandidateDOD.propTypes = { dataURL: PropTypes.string, tabName: PropTypes.string, action: PropTypes.string, + t: PropTypes.string.isRequired, }; export default withTranslation(['candidate_parameters', 'loris'])(CandidateDOD); diff --git a/modules/candidate_parameters/jsx/CandidateInfo.js b/modules/candidate_parameters/jsx/CandidateInfo.js index 8c8501f2505..72e2ad2cc27 100644 --- a/modules/candidate_parameters/jsx/CandidateInfo.js +++ b/modules/candidate_parameters/jsx/CandidateInfo.js @@ -45,6 +45,7 @@ class CandidateInfo extends Component { * Called by React when the component has been rendered on the page. */ componentDidMount() { + const {t} = this.props; let that = this; $.ajax( this.props.dataURL, @@ -255,7 +256,8 @@ class CandidateInfo extends Component { } else if (this.state.updateResult === 'error') { let errorMessage = this.state.errorMessage; alertClass = 'alert alert-danger text-center'; - alertMessage = errorMessage ? errorMessage : t('Failed to update!', {ns: 'loris'}); + alertMessage = + errorMessage ? errorMessage : t('Failed to update!', {ns: 'loris'}); } } @@ -278,7 +280,10 @@ class CandidateInfo extends Component { text={this.state.Data.candID} /> - {t('Return to timepoint list', {ns: 'candidate_parameters'})} + {t('Return to timepoint list', {ns: 'candidate_parameters'})}
@@ -135,6 +135,7 @@ class CandidateParameters extends Component { CandidateParameters.propTypes = { candID: PropTypes.string.isRequired, + t: PropTypes.string.isRequired, }; /** @@ -147,7 +148,7 @@ window.addEventListener('load', () => { const TranslatedCandidateParameters = withTranslation( ['candidate_parameters', 'loris'] - )(CandidateParameters) + )(CandidateParameters); createRoot( document.getElementById('lorisworkspace') diff --git a/modules/candidate_parameters/jsx/ConsentStatus.js b/modules/candidate_parameters/jsx/ConsentStatus.js index 925cd93d803..65236cd0cc9 100644 --- a/modules/candidate_parameters/jsx/ConsentStatus.js +++ b/modules/candidate_parameters/jsx/ConsentStatus.js @@ -80,7 +80,6 @@ class ConsentStatus extends Component { if (data.consentStatuses[cStatus] === 'yes' || data.consentStatuses[cStatus] === 'no' ) { - formData[cOptions] = { yes: t('Yes', {ns: 'loris'}), no: t('No', {ns: 'loris'}), @@ -183,7 +182,10 @@ class ConsentStatus extends Component { if (date1 !== date2) { swal.fire({ title: t('Error!', {ns: 'loris'}), - text: t('{{label}} dates do not match!', {ns: 'candidate_parameters', label: label}), + text: + t('{{label}} dates do not match!', + {ns: 'candidate_parameters', label: label} + ), type: 'error', confirmButtonText: t('OK', {ns: 'loris'}), }); @@ -192,7 +194,10 @@ class ConsentStatus extends Component { if (date1 > today) { swal.fire({ title: t('Error!', {ns: 'loris'}), - text: t('{{label}} date cannot be later than today!', {ns: 'candidate_parameters', label: label}), + text: + t('{{label}} date cannot be later than today!', + {ns: 'candidate_parameters', label: label} + ), type: 'error', confirmButtonText: t('OK', {ns: 'loris'}), }); @@ -210,7 +215,10 @@ class ConsentStatus extends Component { if (withdrawDate1 !== withdrawDate2) { swal.fire({ title: t('Error!', {ns: 'loris'}), - text: t('{{label}} withdrawal dates do not match!', {ns: 'candidate_parameters', label: label}), + text: + t('{{label}} withdrawal dates do not match!', + {ns: 'candidate_parameters', label: label} + ), type: 'error', confirmButtonText: t('OK', {ns: 'loris'}), }); @@ -219,7 +227,10 @@ class ConsentStatus extends Component { if (withdrawDate1 > today) { swal.fire({ title: t('Error!', {ns: 'loris'}), - text: t('{{label}} withdrawal date cannot be later than today!', {ns: 'candidate_parameters', label: label}), + text: + t('{{label}} withdrawal date cannot be later than today!', + {ns: 'candidate_parameters', label: label} + ), type: 'error', confirmButtonText: t('OK', {ns: 'loris'}), }); @@ -228,7 +239,11 @@ class ConsentStatus extends Component { if (withdrawDate1 < date1) { swal.fire({ title: t('Error!', {ns: 'loris'}), - text: t('{{label}} withdrawal date cannot be earlier than response date!', {ns: 'candidate_parameters', label: label}), + text: + t('{{label}} withdrawal date cannot be earlier ' + + 'than response date!', + {ns: 'candidate_parameters', label: label} + ), type: 'error', confirmButtonText: t('OK', {ns: 'loris'}), }); @@ -259,11 +274,11 @@ class ConsentStatus extends Component { processData: false, success: (data) => { swal.fire({ - title: t('Success!', {ns: 'loris'}), - text: t('Update successful.', {ns: 'candidate_parameters'}), - type: 'success', - confirmButtonText: t('OK', {ns: 'loris'}), - }) + title: t('Success!', {ns: 'loris'}), + text: t('Update successful.', {ns: 'candidate_parameters'}), + type: 'success', + confirmButtonText: t('OK', {ns: 'loris'}), + }) .then((result) => { if (result.value) { this.setState({submitDisabled: false}); @@ -277,7 +292,8 @@ class ConsentStatus extends Component { console.error(error); // Enable submit button for form resubmission this.setState({submitDisabled: false}); - let errorMessage = error.responseText || t('Failed to update!', {ns: 'candidate_parameters'}); + let errorMessage = error.responseText || + t('Failed to update!', {ns: 'candidate_parameters'}); swal.fire({ title: t('Error!', {ns: 'loris'}), text: errorMessage, @@ -303,7 +319,8 @@ class ConsentStatus extends Component { renderFormattedHistory() { const {t} = this.props; const historyBtnLabel = this.state.showHistory ? - t('Hide Consent History', {ns: 'candidate_parameters'}) : t('Show Consent History', {ns: 'candidate_parameters'}); + t('Hide Consent History', {ns: 'candidate_parameters'}) : + t('Show Consent History', {ns: 'candidate_parameters'}); const formattedHistory = this.state.Data.history.map((info, key) => { const label = info.label; const dataEntry = info.data_entry_date; @@ -314,16 +331,22 @@ class ConsentStatus extends Component { const dateHistory = consentDate ? ( - , {t('Date of Consent to {{consentDate}}', {ns: 'candidate_parameters', consentDate: consentDate})} + , {t('Date of Consent to {{consentDate}}', + {ns: 'candidate_parameters', consentDate: consentDate}) + } ) : null; const withdrawalHistory = withdrawal ? ( - , {t('Date of Consent Withdrawal to {{withdrawal}}', {ns: 'candidate_parameters', withdrawal: withdrawal})} + , {t('Date of Consent Withdrawal to {{withdrawal}}', + {ns: 'candidate_parameters', withdrawal: withdrawal}) + } ) : null; -{t('Date of Consent to {{consentDate}}', {ns: 'candidate_parameters', consentDate: consentDate})} + {t('Date of Consent to {{consentDate}}', + {ns: 'candidate_parameters', consentDate: consentDate}); + } return (

@@ -331,7 +354,9 @@ class ConsentStatus extends Component { {dataEntry} - {user} - {t('updated for {{label}}:', {ns: 'candidate_parameters', label: label})} + {t('updated for {{label}}:', + {ns: 'candidate_parameters', label: label}) + } {t('Status to ', {ns: 'candidate_parameters'})} {consentStatus} {dateHistory} @@ -407,13 +432,18 @@ class ConsentStatus extends Component { const statusLabel = t('Response', {ns: 'candidate_parameters'}); const consentDate = consentName + '_date'; const consentDate2 = consentName + '_date2'; - const consentDateLabel = t('Date of Response', {ns: 'candidate_parameters'}); - const consentDateConfirmationLabel = t('Confirmation Date of Response', {ns: 'candidate_parameters'}); + const consentDateLabel = + t('Date of Response', {ns: 'candidate_parameters'}); + const consentDateConfirmationLabel = + t('Confirmation Date of Response', {ns: 'candidate_parameters'}); const consentWithdrawal = consentName + '_withdrawal'; const consentWithdrawal2 = consentName + '_withdrawal2'; - const consentWithdrawalLabel = t('Date of Withdrawal of Consent', {ns: 'candidate_parameters'}); + const consentWithdrawalLabel = + t('Date of Withdrawal of Consent', {ns: 'candidate_parameters'}); const consentWithdrawalConfirmationLabel = - t('Confirmation Date of Withdrawal of Consent', {ns: 'candidate_parameters'}); + t('Confirmation Date of Withdrawal of Consent', + {ns: 'candidate_parameters'} + ); return (
@@ -476,7 +506,9 @@ class ConsentStatus extends Component { // If error occurs, return a message. // XXX: Replace this with a UI component for 500 errors. if (this.state.error) { - return

{t('An error occured while loading the page.', {ns: 'loris'})}

; + return ( +

{t('An error occured while loading the page.', {ns: 'loris'})}

+ ); } if (!this.state.isLoaded) { @@ -545,6 +577,9 @@ ConsentStatus.propTypes = { dataURL: PropTypes.string.isRequired, action: PropTypes.string.isRequired, tabName: PropTypes.string, + t: PropTypes.string.isRequired, }; -export default withTranslation(['candidate_parameters', 'loris'])(ConsentStatus); +export default withTranslation( + ['candidate_parameters', 'loris'] +)(ConsentStatus); diff --git a/modules/candidate_parameters/jsx/DiagnosisEvolution.js b/modules/candidate_parameters/jsx/DiagnosisEvolution.js index be9afbb7716..ba818feb092 100644 --- a/modules/candidate_parameters/jsx/DiagnosisEvolution.js +++ b/modules/candidate_parameters/jsx/DiagnosisEvolution.js @@ -147,7 +147,9 @@ class DiagnosisEvolution extends Component { render() { const {t} = this.props; if (this.state.error) { - return

{t('An error occured while loading the page.', {ns: 'loris'})}

; + return ( +

{t('An error occured while loading the page.', {ns: 'loris'})}

+ ); } if (!this.state.isLoaded) { @@ -249,5 +251,8 @@ DiagnosisEvolution.propTypes = { submitURL: PropTypes.string, dataURL: PropTypes.string, tabName: PropTypes.string, + t: PropTypes.string.isRequired, }; -export default withTranslation(['candidate_parameters', 'loris'])(DiagnosisEvolution); +export default withTranslation( + ['candidate_parameters', 'loris'] +)(DiagnosisEvolution); diff --git a/modules/candidate_parameters/jsx/FamilyInfo.js b/modules/candidate_parameters/jsx/FamilyInfo.js index 1017adb6e4f..75048dfdcf8 100644 --- a/modules/candidate_parameters/jsx/FamilyInfo.js +++ b/modules/candidate_parameters/jsx/FamilyInfo.js @@ -40,6 +40,7 @@ class FamilyInfo extends Component { * Fetch data */ fetchData() { + const {t} = this.props; $.ajax( this.props.dataURL, { @@ -64,7 +65,9 @@ class FamilyInfo extends Component { }.bind(this), error: function(data, errorCode, errorMsg) { this.setState({ - error: t('An error occurred when loading the form!', {ns: 'candidate_parameters'}), + error: t('An error occurred when loading the form!', + {ns: 'candidate_parameters'} + ), }); }.bind(this), } @@ -139,7 +142,8 @@ class FamilyInfo extends Component { let addButton = null; if (loris.userHasPermission('candidate_parameter_edit')) { disabled = false; - addButton = ; + addButton = + ; } let candidateList = this.state.Data.candidates; @@ -156,7 +160,9 @@ class FamilyInfo extends Component { familyMembersHTML.push(
{candID}} /> { this.setState({ - error: t('An error occurred when loading the form!', {ns: 'candidate_parameters'}), + error: t('An error occurred when loading the form!', + {ns: 'candidate_parameters'} + ), }); }, }); @@ -135,7 +138,10 @@ class ProbandInfo extends Component { if (dob1 > today) { swal.fire({ title: t('Error!', {ns: 'loris'}), - text: t('Proband date of birth cannot be later than today!', {ns: 'candidate_parameters'}), + text: + t('Proband date of birth cannot be later than today!', + {ns: 'candidate_parameters'} + ), type: 'error', confirmButtonText: t('OK', {ns: 'loris'}), }); @@ -297,7 +303,8 @@ class ProbandInfo extends Component { } else if (this.state.updateResult === 'error') { let errorMessage = this.state.errorMessage; alertClass = 'alert alert-danger text-center'; - alertMessage = errorMessage ? errorMessage : t('Failed to update!', {ns: 'candidate_parameters'}); + alertMessage = errorMessage ? errorMessage : + t('Failed to update!', {ns: 'candidate_parameters'}); } } @@ -364,6 +371,7 @@ ProbandInfo.propTypes = { dataURL: PropTypes.string.isRequired, action: PropTypes.string.isRequired, tabName: PropTypes.string, + t: PropTypes.string.isRequired, }; export default withTranslation(['candidate_parameters', 'loris'])(ProbandInfo); From 3a16316eeef51ddcae60ad86f8c54d4e10f69f69 Mon Sep 17 00:00:00 2001 From: lorisadmin Date: Mon, 8 Dec 2025 07:46:11 +0000 Subject: [PATCH 5/7] Missing translations. --- Makefile | 1 + modules/candidate_parameters/jsx/ParticipantStatus.js | 6 +++--- .../candidate_parameters/locale/candidate_parameters.pot | 9 +++++++++ .../locale/es/LC_MESSAGES/candidate_parameters.po | 9 +++++++++ 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index a517ef9370a..6141ab64418 100755 --- a/Makefile +++ b/Makefile @@ -100,6 +100,7 @@ POFILES=locale/fr/LC_MESSAGES/loris.po \ modules/publication/locale/en/LC_MESSAGES/publication.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/ja/LC_MESSAGES/imaging_browser.po \ modules/imaging_browser/locale/hi/LC_MESSAGES/imaging_browser.po \ modules/help_editor/locale/ja/LC_MESSAGES/help_editor.po \ diff --git a/modules/candidate_parameters/jsx/ParticipantStatus.js b/modules/candidate_parameters/jsx/ParticipantStatus.js index c76a9fde5b3..7e085581388 100644 --- a/modules/candidate_parameters/jsx/ParticipantStatus.js +++ b/modules/candidate_parameters/jsx/ParticipantStatus.js @@ -182,17 +182,17 @@ class ParticipantStatus extends Component { line += ' '; break; case 'status': - line += ' Status: '; + line += t(' Status: ', {ns: 'candidate_parameters'}); line += current; line += ' '; break; case 'suboption': - line += 'Details: '; + line += t('Details: ', {ns: 'candidate_parameters'}); line += current; line += ' '; break; case 'reason_specify': - line += 'Comments: '; + line += t('Comments: ', {ns: 'candidate_parameters'}); line += current; line += ' '; break; diff --git a/modules/candidate_parameters/locale/candidate_parameters.pot b/modules/candidate_parameters/locale/candidate_parameters.pot index 71e9687dc46..a3ec9135d18 100644 --- a/modules/candidate_parameters/locale/candidate_parameters.pot +++ b/modules/candidate_parameters/locale/candidate_parameters.pot @@ -218,3 +218,12 @@ msgstr "" msgid "Status to " msgstr "" + +msgid " Status: " +msgstr "" + +msgid "Details: " +msgstr "" + +msgid "Comments: " +msgstr "" diff --git a/modules/candidate_parameters/locale/es/LC_MESSAGES/candidate_parameters.po b/modules/candidate_parameters/locale/es/LC_MESSAGES/candidate_parameters.po index 5ee48466be2..38fcbe3bcfd 100644 --- a/modules/candidate_parameters/locale/es/LC_MESSAGES/candidate_parameters.po +++ b/modules/candidate_parameters/locale/es/LC_MESSAGES/candidate_parameters.po @@ -218,3 +218,12 @@ msgstr "actualizado para {{label}}:" msgid "Status to " msgstr "Estado a " + +msgid " Status: " +msgstr " Estado: " + +msgid "Details: " +msgstr "Detalles: " + +msgid "Comments: " +msgstr "Comentarios: " From 837e426b71a6db742c129b60ee740f4027c8d0d0 Mon Sep 17 00:00:00 2001 From: lorisadmin Date: Fri, 12 Dec 2025 21:22:55 +0000 Subject: [PATCH 6/7] Fixes duplicates/inconsistencies in .pot files. --- locale/es/LC_MESSAGES/loris.po | 43 +++++++++++++++---- locale/loris.pot | 3 ++ .../jsx/ParticipantStatus.js | 4 +- 3 files changed, 39 insertions(+), 11 deletions(-) diff --git a/locale/es/LC_MESSAGES/loris.po b/locale/es/LC_MESSAGES/loris.po index b81eee937eb..1485ef4800c 100644 --- a/locale/es/LC_MESSAGES/loris.po +++ b/locale/es/LC_MESSAGES/loris.po @@ -281,15 +281,6 @@ msgstr "Vistas" msgid "NEW" msgstr "Nuevo" -msgid "Update" -msgstr "Actualizar" - -msgid "Update Successful!" -msgstr "Actualización Exitosa!" - -msgid "Failed to update!" -msgstr "Actualización Fallida!" - msgid "Updated" msgstr "Actualizado" @@ -376,3 +367,37 @@ msgstr "{{years}} años" msgid "File to upload" msgstr "Archivo para subir" +# Other generic terms +msgid "Loading..." +msgstr "" + +msgid "Permission denied" +msgstr "" + +msgid "Unauthorized" +msgstr "" + +msgid "File to upload" +msgstr "" + +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