From cfd47f691fb7dc1eae55997a6db54f7d5c810553 Mon Sep 17 00:00:00 2001 From: Bradley Taylor Date: Sun, 31 Oct 2021 18:03:35 +0000 Subject: [PATCH] Avoid hardcoded text in setStatus calls; make translatable --- CRM/Admin/Form/PaymentProcessor.php | 4 ++-- CRM/Admin/Form/Setting/Smtp.php | 2 +- CRM/Core/BAO/RecurringEntity.php | 2 +- CRM/Event/Form/Task/PickProfile.php | 7 +++++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CRM/Admin/Form/PaymentProcessor.php b/CRM/Admin/Form/PaymentProcessor.php index ecbc31c677..c0e40ceb1f 100644 --- a/CRM/Admin/Form/PaymentProcessor.php +++ b/CRM/Admin/Form/PaymentProcessor.php @@ -367,7 +367,7 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form { $defaults['payment_processor_type_id'] = $this->_paymentProcessorType; } else { - CRM_Core_Session::setStatus('Payment Processor Type (ID=' . $this->_paymentProcessorType . ') not found. Did you disable the payment processor extension?', 'Missing Payment Processor', 'alert'); + CRM_Core_Session::setStatus(ts('Payment Processor Type (ID=%1) not found. Did you disable the payment processor extension?', [1 => $this->_paymentProcessorType]), ts('Missing Payment Processor'), 'alert'); } $cards = json_decode(CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessor', @@ -435,7 +435,7 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form { $processor = civicrm_api3('payment_processor', 'getsingle', ['name' => $values['name'], 'is_test' => 0]); $errors = Civi\Payment\System::singleton()->checkProcessorConfig($processor); if ($errors) { - CRM_Core_Session::setStatus($errors, 'Payment processor configuration invalid', 'error'); + CRM_Core_Session::setStatus($errors, ts('Payment processor configuration invalid'), 'error'); Civi::log()->error('Payment processor configuration invalid: ' . $errors); CRM_Core_Session::singleton()->pushUserContext($this->refreshURL); } diff --git a/CRM/Admin/Form/Setting/Smtp.php b/CRM/Admin/Form/Setting/Smtp.php index cf44ea62d6..0d4546d3e6 100644 --- a/CRM/Admin/Form/Setting/Smtp.php +++ b/CRM/Admin/Form/Setting/Smtp.php @@ -70,7 +70,7 @@ class CRM_Admin_Form_Setting_Smtp extends CRM_Admin_Form_Setting { $this->getElement('buttons')->setElements($buttons); if (!empty($setStatus)) { - CRM_Core_Session::setStatus("Some fields are loaded as 'readonly' as they have been set (overridden) in civicrm.settings.php.", '', 'info', array('expires' => 0)); + CRM_Core_Session::setStatus(ts("Some fields are loaded as 'readonly' as they have been set (overridden) in civicrm.settings.php."), '', 'info', array('expires' => 0)); } } diff --git a/CRM/Core/BAO/RecurringEntity.php b/CRM/Core/BAO/RecurringEntity.php index 750959d45b..55b185bbea 100644 --- a/CRM/Core/BAO/RecurringEntity.php +++ b/CRM/Core/BAO/RecurringEntity.php @@ -1138,7 +1138,7 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity implemen $dao = self::$_tableDAOMapper[$linkedEntityTable]; } else { - CRM_Core_Session::setStatus('Could not update mode for linked entities'); + CRM_Core_Session::setStatus(ts('Could not update mode for linked entities')); return NULL; } $entityTable = $linkedEntityTable; diff --git a/CRM/Event/Form/Task/PickProfile.php b/CRM/Event/Form/Task/PickProfile.php index 6ec7b87576..0727d389e5 100644 --- a/CRM/Event/Form/Task/PickProfile.php +++ b/CRM/Event/Form/Task/PickProfile.php @@ -56,7 +56,10 @@ class CRM_Event_Form_Task_PickProfile extends CRM_Event_Form_Task { $validate = FALSE; //validations if (count($this->_participantIds) > $this->_maxParticipations) { - CRM_Core_Session::setStatus("The maximum number of records you can select for Update multiple participants is {$this->_maxParticipations}. You have selected " . count($this->_participantIds) . ". Please select fewer participantions from your search results and try again."); + CRM_Core_Session::setStatus(ts("The maximum number of records you can select for Update multiple participants is %1. You have selected %2. Please select fewer participants from your search results and try again.", [ + 1 => $this->_maxParticipations, + 2 => count($this->_participantIds), + ])); $validate = TRUE; } @@ -77,7 +80,7 @@ class CRM_Event_Form_Task_PickProfile extends CRM_Event_Form_Task { $profiles = CRM_Core_BAO_UFGroup::getProfiles($types, TRUE); if (empty($profiles)) { - CRM_Core_Session::setStatus("To use Update multiple participants, you need to configure a profile containing only Participant fields (e.g. Participant Status, Participant Role, etc.). Configure a profile at 'Administer CiviCRM >> Customize >> CiviCRM Profile'."); + CRM_Core_Session::setStatus(ts("To use Update multiple participants, you need to configure a profile containing only Participant fields (e.g. Participant Status, Participant Role, etc.). Configure a profile at 'Administer CiviCRM >> Customize >> CiviCRM Profile'.")); CRM_Utils_System::redirect($this->_userContext); } -- 2.25.1