diff --git a/Makefile b/Makefile index 22ff3e115ee..93e9b0d0215 100755 --- a/Makefile +++ b/Makefile @@ -89,6 +89,7 @@ POFILES=locale/fr/LC_MESSAGES/loris.po \ modules/electrophysiology_uploader/locale/ja/LC_MESSAGES/electrophysiology_uploader.po \ modules/electrophysiology_uploader/locale/hi/LC_MESSAGES/electrophysiology_uploader.po \ modules/acknowledgements/locale/ja/LC_MESSAGES/acknowledgements.po \ + modules/survey_accounts/locale/hi/LC_MESSAGES/survey_accounts.po \ modules/survey_accounts/locale/ja/LC_MESSAGES/survey_accounts.po \ modules/battery_manager/locale/ja/LC_MESSAGES/battery_manager.po \ modules/battery_manager/locale/hi/LC_MESSAGES/battery_manager.po \ @@ -237,4 +238,7 @@ my_preferences: $(filter modules/my_preferences/%,$(MOFILES)) $(filter modules/m target=my_preferences npm run compile electrophysiology_browser: $(filter modules/electrophysiology_browser/%,$(MOFILES)) $(filter modules/electrophysiology_browser/%,$(I18NJSONFILES)) - target=electrophysiology_browser npm run compile + target=electrophysiology_browser npm run compile + +survey_accounts: $(filter modules/survey_accounts/%,$(MOFILES)) $(filter modules/survey_accounts/%,$(I18NJSONFILES)) + target=survey_accounts npm run compile diff --git a/locale/hi/LC_MESSAGES/loris.po b/locale/hi/LC_MESSAGES/loris.po index b870500e9cc..194450bfe73 100644 --- a/locale/hi/LC_MESSAGES/loris.po +++ b/locale/hi/LC_MESSAGES/loris.po @@ -307,6 +307,21 @@ msgstr "जन्म तिथि" msgid "Visits" msgstr "भ्रमण" +msgid "Visit" +msgstr "भेंट" + +msgid "Created" +msgstr "बनाया गया" + +msgid "Sent" +msgstr "भेजा गया" + +msgid "In Progress" +msgstr "प्रगति पर" + +msgid "Complete" +msgstr "पूर्ण" + msgid "An error occured while loading the page." msgstr "पृष्ठ लोड करते समय एक त्रुटि हुई।" @@ -451,9 +466,6 @@ msgstr "कुल" msgid "Screening" msgstr "जांच" -msgid "Visit" -msgstr "भेंट" - msgid "Approval" msgstr "स्वीकृति" @@ -469,18 +481,12 @@ msgstr "विफलता" msgid "Withdrawal" msgstr "निकासी" -msgid "In Progress" -msgstr "प्रगति पर" - msgid "Progress" msgstr "प्रगति" msgid "Success" msgstr "सफलता" -msgid "Complete" -msgstr "पूर्ण" - msgid "Instrument" msgid_plural "Instruments" msgstr[0] "उपकरण" diff --git a/locale/loris.pot b/locale/loris.pot index 2d849e0ede2..ee6b45ecf16 100644 --- a/locale/loris.pot +++ b/locale/loris.pot @@ -279,6 +279,21 @@ msgstr "" msgid "Visits" msgstr "" +msgid "Visit" +msgstr "" + +msgid "Created" +msgstr "" + +msgid "Sent" +msgstr "" + +msgid "In Progress" +msgstr "" + +msgid "Complete" +msgstr "" + msgid "An error occured while loading the page." msgstr "" @@ -462,9 +477,6 @@ msgstr "" msgid "Screening" msgstr "" -msgid "Visit" -msgstr "" - msgid "Approval" msgstr "" @@ -483,18 +495,12 @@ msgstr "" msgid "Withdrawn" msgstr "" -msgid "In Progress" -msgstr "" - msgid "Progress" msgstr "" msgid "Success" msgstr "" -msgid "Complete" -msgstr "" - msgid "Instrument" msgid_plural "Instruments" msgstr[0] "" diff --git a/modules/survey_accounts/ajax/ValidateEmailSubmitInput.php b/modules/survey_accounts/ajax/ValidateEmailSubmitInput.php index e896ce31bd2..23454fad8bb 100644 --- a/modules/survey_accounts/ajax/ValidateEmailSubmitInput.php +++ b/modules/survey_accounts/ajax/ValidateEmailSubmitInput.php @@ -42,7 +42,10 @@ 'v_CandID' => $_REQUEST['dccid'], ] ); -$error_msg = "PSCID and DCC ID do not match or candidate does not exist."; +$error_msg = dgettext( + 'survey_accounts', + 'PSCID and DCCID do not match or candidate does not exist.' +); if ($numCandidates != 1) { echo json_encode( ['error_msg' => $error_msg] @@ -65,8 +68,8 @@ if ($numSessions != 1) { echo json_encode( [ - 'error_msg' => "Visit ". $_REQUEST['VL']. - " does not exist for given candidate", + 'error_msg' => dgettext('loris', 'Visit').' '. $_REQUEST['VL'].' '. + dgettext('survey_accounts', 'does not exist for given candidate'), ] ); exit(0); @@ -74,7 +77,7 @@ if (empty($_REQUEST['TN'])) { echo json_encode( - ['error_msg' => 'Please choose an instrument'] + ['error_msg' => dgettext('survey_accounts', 'Please choose an instrument')] ); exit(0); } @@ -96,8 +99,11 @@ if ($_REQUEST['TN'] == $instrument['Test_name']) { echo json_encode( [ - 'error_msg' => "Instrument ". $_REQUEST['TN']. - " already exists for given candidate for visit ". $_REQUEST['VL'], + 'error_msg' => dgettext('loris', 'Instrument').' '. $_REQUEST['TN'] + .' ' .dgettext( + 'survey_accounts', + 'already exists for given candidate for visit' + ).' '. $_REQUEST['VL'], ] ); exit(0); @@ -107,7 +113,11 @@ if (!empty($_REQUEST['Email']) ) { if (!filter_var($_REQUEST['Email'], FILTER_VALIDATE_EMAIL) ) { echo json_encode( - ['error_msg' => 'The email address is not valid.'] + ['error_msg' => dgettext( + 'survey_accounts', + 'The email address is not valid.' + ) + ] ); exit(0); } diff --git a/modules/survey_accounts/jsx/surveyAccountsIndex.js b/modules/survey_accounts/jsx/surveyAccountsIndex.js index c24aa2fdd5f..3b958099ebc 100644 --- a/modules/survey_accounts/jsx/surveyAccountsIndex.js +++ b/modules/survey_accounts/jsx/surveyAccountsIndex.js @@ -8,6 +8,7 @@ import {withTranslation} from 'react-i18next'; import Loader from 'Loader'; import FilterableDataTable from 'FilterableDataTable'; +import hiStrings from '../locale/hi/LC_MESSAGES/survey_accounts.json'; /** * Survey Account React Component */ @@ -63,13 +64,14 @@ class SurveyAccountsIndex extends Component { * @return {*} a formated table cell for a given column */ formatColumn(column, cell, row) { + const {t} = this.props; let result = {cell}; switch (column) { - case 'URL': + case t('URL', {ns: 'survey_accounts'}): const url = loris.BaseURL + '/survey.php?key=' + row.URL; result = {cell}; break; - case 'Instrument': + case t('Instrument', {ns: 'loris', count: 1}): result = {this.state.data.fieldOptions.instruments[cell]}; break; } @@ -83,10 +85,13 @@ class SurveyAccountsIndex 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 occured while loading the page.

; + return

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

; } // Waiting for async data to load @@ -100,22 +105,22 @@ class SurveyAccountsIndex extends Component { */ const options = this.state.data.fieldOptions; const fields = [ - {label: 'PSCID', show: true, filter: { + {label: t('PSCID', {ns: 'loris'}), show: true, filter: { name: 'pscid', type: 'text', }}, - {label: 'Visit', show: true, filter: { + {label: t('Visit', {ns: 'loris'}), show: true, filter: { name: 'visit', type: 'select', options: options.visits, }}, - {label: 'Instrument', show: true, filter: { + {label: t('Instrument', {ns: 'loris', count: 1}), show: true, filter: { name: 'instrument', type: 'select', options: options.instruments, }}, - {label: 'URL', show: true}, - {label: 'Status', show: true, filter: { + {label: t('URL', {ns: 'survey_accounts'}), show: true}, + {label: t('Status', {ns: 'survey_accounts'}), show: true, filter: { name: 'Status', type: 'select', options: options.statusOptions, @@ -125,13 +130,13 @@ class SurveyAccountsIndex extends Component { location.href='/survey_accounts/addSurvey/'; }; const actions = [ - {label: 'Add Survey', action: addSurvey}, + {label: t('Add Survey', {ns: 'survey_accounts'}), action: addSurvey}, ]; return ( { - i18n.addResourceBundle('ja', 'survey_accounts', {}); + i18n.addResourceBundle('hi', 'survey_accounts', hiStrings); const Index = withTranslation( - ['survey_accounts', 'loris'] + ['survey_accounts'] )(SurveyAccountsIndex); createRoot( document.getElementById('lorisworkspace') diff --git a/modules/survey_accounts/locale/hi/LC_MESSAGES/survey_accounts.po b/modules/survey_accounts/locale/hi/LC_MESSAGES/survey_accounts.po new file mode 100644 index 00000000000..bf671acd6ec --- /dev/null +++ b/modules/survey_accounts/locale/hi/LC_MESSAGES/survey_accounts.po @@ -0,0 +1,103 @@ +# 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: hi\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "Survey Accounts" +msgstr "सर्वे खाते" + +msgid "Survey was added successfully." +msgstr "सर्वे सफलतापूर्वक जोड़ा गया।" + +msgid "Click here to go back to view the list of survey's created" +msgstr "बनाए गए सर्वे की सूची देखने के लिए यहाँ क्लिक करें" + +msgid "Survey List" +msgstr "सर्वे सूची" + +msgid "Usage" +msgstr "उपयोग" + +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 "इस फ़ॉर्म का उपयोग अध्ययन प्रतिभागी के लिए लिंक बनाने के लिए करें ताकि वह सीधे Loris में फ़ॉर्म/डेटा दर्ज कर सके।" + +msgid "Add Survey" +msgstr "सर्वे जोड़ें" + +msgid "Create survey" +msgstr "सर्वे बनाएँ" + +msgid "Email survey" +msgstr "सर्वे ईमेल करें" + +msgid "Close" +msgstr "बंद करें" + +msgid "Email to Study Participant" +msgstr "अध्ययन प्रतिभागी को ईमेल" + +msgid "Optionally enter a customized message here. A default email will be sent if left blank." +msgstr "वैकल्पिक रूप से यहाँ एक कस्टम संदेश दर्ज करें। खाली छोड़ने पर डिफ़ॉल्ट ईमेल भेजा जाएगा।" + +msgid "This is where your message goes." +msgstr "यहाँ आपका संदेश जाएगा।" + +msgid "Email" +msgstr "ईमेल" + +msgid "Instrument" +msgstr "यंत्र" + +msgid "URL" +msgstr "यूआरएल" + +msgid "Status" +msgstr "स्थिति" + +msgid "PSCID and DCCID do not match or candidate does not exist." +msgstr "पीएससीआईडी ​​और डीसीसीआईडी ​​मेल नहीं खाते या उम्मीदवार मौजूद नहीं है।" + +msgid "does not exist for given candidate" +msgstr "दिए गए उम्मीदवार के लिए मौजूद नहीं है" + +msgid "Please choose an instrument." +msgstr "कृपया एक उपकरण चुनें." + +msgid "already exists for given candidate for visit" +msgstr "दिए गए उम्मीदवार के लिए यात्रा हेतु पहले से ही मौजूद है" + +msgid "The email address is not valid." +msgstr "ईमेल पता मान्य नहीं है." + +msgid "Please confirm the email address." +msgstr "कृपया ईमेल पता की पुष्टि करें." + +msgid "The email addresses do not match." +msgstr "ईमेल पते मेल नहीं खाते." + +msgid "You must specify a valid Visit Label." +msgstr "आपको एक वैध विज़िट लेबल निर्दिष्ट करना होगा." + +msgid "You are not affiliated with this session's project" +msgstr "आप इस सत्र की परियोजना से संबद्ध नहीं हैं" + +msgid "Confirm Email address" +msgstr "ईमेल पते की पुष्टि करें" + +msgid "Email is not valid." +msgstr "विद्युतडाक मान्य नहीं है।" diff --git a/modules/survey_accounts/locale/survey_accounts.pot b/modules/survey_accounts/locale/survey_accounts.pot index 354363c7bcc..9bd3b188f9e 100644 --- a/modules/survey_accounts/locale/survey_accounts.pot +++ b/modules/survey_accounts/locale/survey_accounts.pot @@ -20,3 +20,84 @@ msgstr "" msgid "Survey Accounts" msgstr "" + +msgid "Survey was added successfully." +msgstr "" + +msgid "Click here to go back to view the list of survey's created" +msgstr "" + +msgid "Survey List" +msgstr "" + +msgid "Usage" +msgstr "" + +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 "" + +msgid "Add Survey" +msgstr "" + +msgid "Create survey" +msgstr "" + +msgid "Email survey" +msgstr "" + +msgid "Close" +msgstr "" + +msgid "Email to Study Participant" +msgstr "" + +msgid "Optionally enter a customized message here. A default email will be sent if left blank." +msgstr "" + +msgid "This is where your message goes." +msgstr "" + +msgid "Email" +msgstr "" + +msgid "Instrument" +msgstr "" + +msgid "URL" +msgstr "" + +msgid "Status" +msgstr "" + +msgid "PSCID and DCCID do not match or candidate does not exist." +msgstr "" + +msgid "does not exist for given candidate" +msgstr "" + +msgid "Please choose an instrument." +msgstr "" + +msgid "already exists for given candidate for visit" +msgstr "" + +msgid "The email address is not valid." +msgstr "" + +msgid "Please confirm the email address." +msgstr "" + +msgid "The email addresses do not match." +msgstr "" + +msgid "You must specify a valid Visit Label." +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 37c53debde0..818e0734d77 100644 --- a/modules/survey_accounts/php/addsurvey.class.inc +++ b/modules/survey_accounts/php/addsurvey.class.inc @@ -65,21 +65,37 @@ class AddSurvey extends \NDB_Form // Check that all required fields are present. if (!empty($values['Email']) ) { if (!filter_var($values['Email'], FILTER_VALIDATE_EMAIL) ) { - return ['Email' => 'The email address is not valid.']; + return ['Email' => dgettext( + 'survey_accounts', + 'The email address is not valid.' + ) + ]; } } if (!empty($values['Email']) && !empty($values['Email2'])) { if ($values['Email'] != $values['Email2']) { - return ['Email2' => 'The email addresses do not match.']; + return ['Email2' => dgettext( + 'survey_accounts', + 'The email addresses do not match.' + ) + ]; } } if (!empty($values['Email']) && empty($values['Email2'])) { - return ['Email2' => 'Please confirm the email address.']; + return ['Email2' => dgettext( + 'survey_accounts', + 'Please confirm the email address.' + ) + ]; } if (empty($values['Test_name'])) { - return ['Test_name' => 'Please choose an instrument.']; + return ['Test_name' => dgettext( + 'survey_accounts', + 'Please choose an instrument.' + ) + ]; } $numCandidates = $db->pselectOne( @@ -91,15 +107,21 @@ class AddSurvey extends \NDB_Form 'v_CandID' => $values['CandID'], ] ); - $error = "PSCID and CandID do not match " - ."or candidate does not exist."; + $error = dgettext( + 'survey_accounts', + 'PSCID and DCCID do not match or candidate does not exist.' + ); if ($numCandidates != 1) { return ['CandID' => $error]; } if (! in_array($values['VL'], \Utility::getVisitList(), true)) { - return ['VL' => "You must specify a valid Visit Label."]; + return ['VL' => dgettext( + 'survey_accounts', + 'You must specify a valid Visit Label.' + ) + ]; } $numSessions = $db->pselectOne( @@ -116,9 +138,12 @@ class AddSurvey extends \NDB_Form if ($numSessions != 1) { return [ - 'VL' => "Visit ". - $values['VL']. - " does not exist for given candidate", + 'VL' => dgettext('loris', "Visit")." ". + $values['VL']." ". + dgettext( + 'survey_accounts', + 'does not exist for given candidate' + ), ]; } @@ -136,7 +161,10 @@ class AddSurvey extends \NDB_Form $user = \NDB_Factory::singleton()->user(); if (!$user->hasProject(\ProjectID::singleton($projectID))) { return [ - 'Project' => "You are not affiliated with this session's project" + 'Project' => dgettext( + 'survey_accounts', + 'You are not affiliated with this session\'s project' + ) ]; } @@ -153,7 +181,10 @@ class AddSurvey extends \NDB_Form 'v_VL' => $values['VL'], ] ); - $reminder = " already exists for given candidate for visit "; + $reminder = dgettext( + 'survey_accounts', + 'already exists for given candidate for visit' + ); foreach ($instrument_list as $instrument) { if ($values['Test_name'] == $instrument['Test_name']) { $instrument_instance = \NDB_BVL_Instrument::factory( @@ -175,7 +206,11 @@ class AddSurvey extends \NDB_Form FILTER_VALIDATE_EMAIL ) ) { - return ['Email' => 'Email is not valid.']; + return ['Email' => dgettext( + 'survey_accounts', + 'Email is not valid.' + ) + ]; } } @@ -302,7 +337,10 @@ class AddSurvey extends \NDB_Form ) ); $this->addBasicText("Email", "Email address"); - $this->addBasicText("Email2", "Confirm Email address"); + $this->addBasicText( + "Email2", + dgettext('survey_accounts', 'Confirm Email address') + ); $this->form->addFormRule([&$this, '_validateAddSurvey']); } diff --git a/modules/survey_accounts/php/survey_accounts.class.inc b/modules/survey_accounts/php/survey_accounts.class.inc index 3b7f758a2c3..fa850fae910 100644 --- a/modules/survey_accounts/php/survey_accounts.class.inc +++ b/modules/survey_accounts/php/survey_accounts.class.inc @@ -76,10 +76,10 @@ class Survey_Accounts extends \DataFrameworkMenu public function getFieldOptions() : array { $statusOptions = [ - 'Created' => 'Created', - 'Sent' => 'Sent', - 'In Progress' => 'In Progress', - 'Complete' => 'Complete', + 'Created' => dgettext("loris", "Created"), + 'Sent' => dgettext("loris", "Sent"), + 'In Progress' => dgettext("loris", "In Progress"), + 'Complete' => dgettext("loris", "Complete"), ]; $instruments diff --git a/modules/survey_accounts/templates/form_addSurvey.tpl b/modules/survey_accounts/templates/form_addSurvey.tpl index df7dfedfcba..d24e0ff5e83 100644 --- a/modules/survey_accounts/templates/form_addSurvey.tpl +++ b/modules/survey_accounts/templates/form_addSurvey.tpl @@ -1,5 +1,9 @@ {if $success} -

Survey was added successfully.
Click here to go back to view the list of survey's created : Survey List

+

+ {dgettext("survey_accounts", "Survey was added successfully.")}
+ {dgettext("survey_accounts", "Click here to go back to view the list of survey's created")} : + {dgettext("survey_accounts", "Survey List")}
+


{/if}
@@ -9,16 +13,16 @@ {if not $success} - + - + {foreach from=$form.errors item=error} @@ -50,14 +54,14 @@ - + @@ -67,15 +71,21 @@ diff --git a/modules/survey_accounts/test/Survey_AccountsTestIntegrationTest.php b/modules/survey_accounts/test/Survey_AccountsTestIntegrationTest.php index c3b598abbce..65f45992f69 100644 --- a/modules/survey_accounts/test/Survey_AccountsTestIntegrationTest.php +++ b/modules/survey_accounts/test/Survey_AccountsTestIntegrationTest.php @@ -302,7 +302,7 @@ function testSurveyAccountsAddSurvey() WebDriverBy::cssSelector(".error") )->getText(); $this->assertStringContainsString( - "PSCID and CandID do not match or candidate does not exist", + "PSCID and DCCID do not match or candidate does not exist", $bodyText ); }
Usage
{dgettext("survey_accounts", "Usage")}
- Use this form to create a link for a study participant to use in order to directly enter a form/data into Loris. + {dgettext("survey_accounts", "Use this form to create a link for a study participant to use in order to directly enter a form/data into Loris.")}
Add Survey
{dgettext("survey_accounts", "Add Survey")}
{$form.Email.label} {$form.Email.html}
{$form.Email2.label} {$form.Email2.html}
- - + + {/if}