Avoid hardcoded text in setStatus calls; make translatable
authorBradley Taylor <hello@brad-taylor.co.uk>
Sun, 31 Oct 2021 18:03:35 +0000 (18:03 +0000)
committerBradley Taylor <hello@brad-taylor.co.uk>
Sun, 31 Oct 2021 18:59:44 +0000 (18:59 +0000)
CRM/Admin/Form/PaymentProcessor.php
CRM/Admin/Form/Setting/Smtp.php
CRM/Core/BAO/RecurringEntity.php
CRM/Event/Form/Task/PickProfile.php

index ecbc31c6773da1bc1d20fb09e140113d3e861c2b..c0e40ceb1faf16f654c8c8cfd90eca4d1344a298 100644 (file)
@@ -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);
     }
index cf44ea62d6af447b891f7750a53fdce7b22ba669..0d4546d3e65c2fd71c46d7ed10bd03eb328f7a4b 100644 (file)
@@ -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));
     }
   }
 
index 750959d45b3ffec4d715b34260f4b8bb1034cdae..55b185bbea9e507cf3725fee9bdc5ccc659f99f4 100644 (file)
@@ -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;
index 6ec7b8757657b466d7b7d35b2be1404d18b21bea..0727d389e540012a5560d5adc011188f1f595ac7 100644 (file)
@@ -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);
     }