diff --git a/modules/survey_accounts/ajax/ValidateEmailSubmitInput.php b/modules/survey_accounts/ajax/ValidateEmailSubmitInput.php index fd16cbe134..526f35d2b1 100644 --- a/modules/survey_accounts/ajax/ValidateEmailSubmitInput.php +++ b/modules/survey_accounts/ajax/ValidateEmailSubmitInput.php @@ -69,7 +69,8 @@ if ($numSessions != 1) { echo json_encode( [ - 'error_msg' => dgettext('loris', 'Visit').' '. $_REQUEST['VL'].' '. + 'error_msg' => dgettext('loris', 'Visit').' '. + $_REQUEST['VL'].' '. dgettext('survey_accounts', 'does not exist for given candidate'), ] ); @@ -78,7 +79,7 @@ if (empty($_REQUEST['TN'])) { echo json_encode( - ['error_msg' => dgettext('survey_accounts', 'Please choose an instrument')] + ['error_msg' => dgettext('survey_accounts', 'Please choose an instrument.')] ); exit(0); } @@ -100,8 +101,13 @@ if ($_REQUEST['TN'] == $instrument['Test_name']) { echo json_encode( [ - 'error_msg' => dgettext('loris', 'Instrument').' '. $_REQUEST['TN'] - .' ' .dgettext( + 'error_msg' => dcngettext( + 'loris', + 'Instrument', + 'Instruments', + 1, + LC_MESSAGES + ).' '. $_REQUEST['TN'].' ' .dgettext( 'survey_accounts', 'already exists for given candidate for visit' ).' '. $_REQUEST['VL'], @@ -116,7 +122,7 @@ echo json_encode( ['error_msg' => dgettext( 'survey_accounts', - 'The email address is not valid.' + 'Email is not valid.' ) ] ); diff --git a/modules/survey_accounts/js/survey_accounts_helper.js b/modules/survey_accounts/js/survey_accounts_helper.js index e458048385..69d4834d23 100644 --- a/modules/survey_accounts/js/survey_accounts_helper.js +++ b/modules/survey_accounts/js/survey_accounts_helper.js @@ -41,7 +41,9 @@ $(document).ready(function () { } if (email.length > 0 && email2.length > 0 && email !== email2) { - $("#email-error").show().html("Emails do not match"); + $("#email-error") + .show() + .html($("#email-error").data("email-mismatch")); } } ); $("#emailData").click(function(){ @@ -60,7 +62,7 @@ $(document).ready(function () { }).appendTo("#participant_accounts_form"); $("#participant_accounts_form").submit(); }); - $("input[type=submit]").click(function (e) { + $("input[type=submit], button[type=submit]").click(function (e) { if(e.currentTarget.classList.contains('email')) { $.get(loris.BaseURL + "/survey_accounts/ajax/ValidateEmailSubmitInput.php", { dccid: $("input[name=CandID]").val(), diff --git a/modules/survey_accounts/jsx/surveyAccountsIndex.js b/modules/survey_accounts/jsx/surveyAccountsIndex.js index 96c40f9fe5..ca16b2f7b5 100644 --- a/modules/survey_accounts/jsx/surveyAccountsIndex.js +++ b/modules/survey_accounts/jsx/surveyAccountsIndex.js @@ -9,6 +9,9 @@ import Loader from 'Loader'; import FilterableDataTable from 'FilterableDataTable'; import hiStrings from '../locale/hi/LC_MESSAGES/survey_accounts.json'; +import jaStrings from '../locale/ja/LC_MESSAGES/survey_accounts.json'; +import frStrings from '../locale/fr/LC_MESSAGES/survey_accounts.json'; +import zhStrings from '../locale/zh/LC_MESSAGES/survey_accounts.json'; /** * Survey Account React Component */ @@ -123,7 +126,9 @@ class SurveyAccountsIndex extends Component { }, }, { - label: t('Instrument', {ns: 'loris', count: 1}), show: true, filter: { + label: t('Instrument', {ns: 'loris', count: 1}), + show: true, + filter: { name: 'instrument', type: 'select', options: options.instruments, @@ -139,7 +144,10 @@ class SurveyAccountsIndex extends Component { }, ]; const addSurvey = () => { - location.href = '/survey_accounts/addSurvey/'; + const params = new URLSearchParams(window.location.search); + const lang = params.get('lang'); + const query = lang ? `?lang=${encodeURIComponent(lang)}` : ''; + location.href = `${loris.BaseURL}/survey_accounts/addSurvey/${query}`; }; const actions = [ {label: t('Add Survey', {ns: 'survey_accounts'}), action: addSurvey}, @@ -167,8 +175,9 @@ SurveyAccountsIndex.propTypes = { window.addEventListener( 'load', () => { i18n.addResourceBundle('hi', 'survey_accounts', hiStrings); - i18n.addResourceBundle('ja', 'survey_accounts', {}); - i18n.addResourceBundle('zh', 'survey_accounts', {}); + i18n.addResourceBundle('ja', 'survey_accounts', jaStrings); + i18n.addResourceBundle('fr', 'survey_accounts', frStrings); + i18n.addResourceBundle('zh', 'survey_accounts', zhStrings); const Index = withTranslation( ['survey_accounts'] )(SurveyAccountsIndex); diff --git a/modules/survey_accounts/locale/fr/LC_MESSAGES/survey_accounts.po b/modules/survey_accounts/locale/fr/LC_MESSAGES/survey_accounts.po new file mode 100644 index 0000000000..02c50dfeb3 --- /dev/null +++ b/modules/survey_accounts/locale/fr/LC_MESSAGES/survey_accounts.po @@ -0,0 +1,98 @@ +# Default LORIS strings to be translated (French Canadian). +# 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: French \n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +msgid "Survey Accounts" +msgstr "Comptes de sondage" + +msgid "Survey was added successfully." +msgstr "Le sondage a été ajouté avec succès." + +msgid "Click here to go back to view the list of survey's created" +msgstr "Cliquez ici pour revenir à la liste des sondages créés" + +msgid "Survey List" +msgstr "Liste des sondages" + +msgid "Usage" +msgstr "Utilisation" + +msgid "Use this form to create a link for a study participant to use in order to directly enter a form/data into Loris." +msgstr "Utilisez ce formulaire pour créer un lien permettant à un participant à l'étude de saisir directement un formulaire/des données dans LORIS." + +msgid "Add Survey" +msgstr "Ajouter un sondage" + +msgid "Create survey" +msgstr "Créer un sondage" + +msgid "Email survey" +msgstr "Envoyer le sondage par courriel" + +msgid "Close" +msgstr "Fermer" + +msgid "Email to Study Participant" +msgstr "Courriel au participant à l'étude" + +msgid "Optionally enter a customized message here. A default email will be sent if left blank." +msgstr "Saisissez éventuellement un message personnalisé ici. Un courriel par défaut sera envoyé si ce champ est laissé vide." + +msgid "This is where your message goes." +msgstr "Votre message s'inscrit ici." + +msgid "Email" +msgstr "Adresse courriel" + +msgid "URL" +msgstr "URL" + +msgid "Status" +msgstr "Statut" + +msgid "PSCID and DCCID do not match or candidate does not exist." +msgstr "Le PSCID et le DCCID ne correspondent pas ou le candidat n'existe pas." + +msgid "does not exist for given candidate" +msgstr "n'existe pas pour le candidat donné" + +msgid "Please choose an instrument." +msgstr "Veuillez choisir un instrument." + +msgid "already exists for given candidate for visit" +msgstr "existe déjà pour le candidat donné pour la visite" + +msgid "Email is not valid." +msgstr "L'adresse courriel n'est pas valide." + +msgid "Please confirm the email address." +msgstr "Veuillez confirmer l'adresse courriel." + +msgid "The email addresses do not match." +msgstr "Les adresses courriel ne correspondent pas." + +msgid "You must specify a valid Visit Label." +msgstr "Vous devez préciser un libellé de visite valide." + +msgid "You are not affiliated with this session's project" +msgstr "Vous n'êtes pas affilié au projet de cette session" + +msgid "Confirm Email address" +msgstr "Confirmer l'adresse courriel" diff --git a/modules/survey_accounts/locale/survey_accounts.pot b/modules/survey_accounts/locale/survey_accounts.pot index 9bd3b188f9..67e76b9db0 100644 --- a/modules/survey_accounts/locale/survey_accounts.pot +++ b/modules/survey_accounts/locale/survey_accounts.pot @@ -60,9 +60,6 @@ msgstr "" msgid "Email" msgstr "" -msgid "Instrument" -msgstr "" - msgid "URL" msgstr "" @@ -81,7 +78,7 @@ msgstr "" msgid "already exists for given candidate for visit" msgstr "" -msgid "The email address is not valid." +msgid "Email is not valid." msgstr "" msgid "Please confirm the email address." @@ -96,8 +93,5 @@ msgstr "" msgid "You are not affiliated with this session's project" msgstr "" -msgid "Email is not valid." -msgstr "" - msgid "Confirm Email address" msgstr "" diff --git a/modules/survey_accounts/php/addsurvey.class.inc b/modules/survey_accounts/php/addsurvey.class.inc index 6635d4ed0e..2c3b728d6c 100644 --- a/modules/survey_accounts/php/addsurvey.class.inc +++ b/modules/survey_accounts/php/addsurvey.class.inc @@ -68,7 +68,7 @@ class AddSurvey extends \NDB_Form if (!filter_var($values['Email'], FILTER_VALIDATE_EMAIL) ) { return ['Email' => dgettext( 'survey_accounts', - 'The email address is not valid.' + 'Email is not valid.' ) ]; } @@ -193,14 +193,20 @@ class AddSurvey extends \NDB_Form $instrument['Test_name'] ); return [ - 'Test_name' => "Instrument ". + 'Test_name' => dcngettext( + 'loris', + 'Instrument', + 'Instruments', + 1, + LC_MESSAGES + )." ". $instrument_instance->getFullName(). $reminder. $values['VL'], ]; } } if (!isset($_REQUEST['fire_away']) - || ($_REQUEST['fire_away'] !== 'Create survey') + || ($_REQUEST['fire_away'] !== 'create_survey') ) { if (!filter_var( $values['Email'], @@ -326,18 +332,28 @@ class AddSurvey extends \NDB_Form parent::setup(); $this->redirect = "test_name=$this->name"; - $this->addBasicText("CandID", "DCCID"); - $this->addBasicText("PSCID", "PSCID"); - $this->addSelect("VL", "Visit Label", \Utility::getVisitList()); + $this->addBasicText("CandID", dgettext('loris', 'DCCID')); + $this->addBasicText("PSCID", dgettext('loris', 'PSCID')); + $this->addSelect( + "VL", + dgettext('loris', 'Visit Label'), + \Utility::getVisitList() + ); $this->addSelect( "Test_name", - "Instrument", + dcngettext( + 'loris', + 'Instrument', + 'Instruments', + 1, + LC_MESSAGES + ), array_merge( ['' => ''], \NDB_BVL_Instrument::getDirectEntryInstrumentNamesList($this->loris) ) ); - $this->addBasicText("Email", "Email address"); + $this->addBasicText("Email", dgettext('loris', 'Email address')); $this->addBasicText( "Email2", dgettext('survey_accounts', 'Confirm Email address') diff --git a/modules/survey_accounts/templates/form_addSurvey.tpl b/modules/survey_accounts/templates/form_addSurvey.tpl index d24e0ff5e8..214783e656 100644 --- a/modules/survey_accounts/templates/form_addSurvey.tpl +++ b/modules/survey_accounts/templates/form_addSurvey.tpl @@ -31,7 +31,7 @@ {/foreach} - + @@ -60,8 +60,8 @@ - - + + {/if}