From a7c57397d229390219e7a1f3ce909d0724b8d23a Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 24 Jul 2015 20:41:29 -0700 Subject: [PATCH] CRM-16355 - bgm addon to change CMS locale - make it temporary --- CRM/Mailing/BAO/MailingJob.php | 9 ++------- CRM/Utils/System/Base.php | 4 ++++ Civi/Core/Container.php | 1 + 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CRM/Mailing/BAO/MailingJob.php b/CRM/Mailing/BAO/MailingJob.php index 81fdcc1928..0eca1a7cdf 100644 --- a/CRM/Mailing/BAO/MailingJob.php +++ b/CRM/Mailing/BAO/MailingJob.php @@ -544,13 +544,8 @@ VALUES (%1, %2, %3, %4, %5, %6, %7) $config = CRM_Core_Config::singleton(); } - if ($mailing->language && $mailing->language != 'en_US') { - // Since we are called from cron, CiviCRM runs in the default language, - // which causes issues for multi-lingual environments. - // NB: we do not switch back once the mailing is finished, - // assuming that CiviCRM stops running after the mail run. - $i18n = CRM_Core_I18n::singleton(); - $i18n->setLocale($mailing->language); + if (property_exists($mailing, 'language') && $mailing->language && $mailing->language != 'en_US') { + $swapLang = CRM_Utils_AutoClean::swap('global://dbLocale?getter', 'call://i18n/setLocale', $mailing->language); } $job_date = CRM_Utils_Date::isoToMysql($this->scheduled_date); diff --git a/CRM/Utils/System/Base.php b/CRM/Utils/System/Base.php index 85ff17cf03..3073ff7dbc 100644 --- a/CRM/Utils/System/Base.php +++ b/CRM/Utils/System/Base.php @@ -426,6 +426,10 @@ abstract class CRM_Utils_System_Base { throw new CRM_Core_Exception("Not implemented: {$className}->getUfId"); } + public function setUFLocale($civicrm_language) { + return TRUE; + } + /** * Set a init session with user object. * diff --git a/Civi/Core/Container.php b/Civi/Core/Container.php index 6c3f0955ba..f7f02ff434 100644 --- a/Civi/Core/Container.php +++ b/Civi/Core/Container.php @@ -183,6 +183,7 @@ class Container { 'resources' => 'CRM_Core_Resources', 'httpClient' => 'CRM_Utils_HttpClient', 'cache.default' => 'CRM_Utils_Cache', + 'i18n' => 'CRM_Core_I18n', // Maybe? 'config' => 'CRM_Core_Config', // Maybe? 'smarty' => 'CRM_Core_Smarty', ); -- 2.25.1