From 389aeb7042e4d7e5771f88686d7e69889aaa4ea1 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Mon, 9 Aug 2021 20:49:30 -0700 Subject: [PATCH] (REF) ActionSchedule - Convert setCommunicationLanguage(...) to setLocale(pickLocale(...)) --- CRM/Core/BAO/ActionSchedule.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CRM/Core/BAO/ActionSchedule.php b/CRM/Core/BAO/ActionSchedule.php index e804f3bc76..abcd747f44 100644 --- a/CRM/Core/BAO/ActionSchedule.php +++ b/CRM/Core/BAO/ActionSchedule.php @@ -271,7 +271,7 @@ FROM civicrm_action_schedule cas // switch language if necessary if ($multilingual) { $preferred_language = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $dao->contactID, 'preferred_language'); - CRM_Core_BAO_ActionSchedule::setCommunicationLanguage($actionSchedule->communication_language, $preferred_language); + CRM_Core_I18n::singleton()->setLocale(CRM_Core_BAO_ActionSchedule::pickLocale($actionSchedule->communication_language, $preferred_language)); } $errors = []; @@ -401,10 +401,11 @@ FROM civicrm_action_schedule cas } /** - * @param $communication_language - * @param $preferred_language + * @param string|null $communication_language + * @param string|null $preferred_language + * @return string */ - public static function setCommunicationLanguage($communication_language, $preferred_language) { + public static function pickLocale($communication_language, $preferred_language) { $currentLocale = CRM_Core_I18n::getLocale(); $language = $currentLocale; @@ -425,8 +426,7 @@ FROM civicrm_action_schedule cas } // change the language - $i18n = CRM_Core_I18n::singleton(); - $i18n->setLocale($language); + return $language; } /** -- 2.25.1