dev/translation#35 Display the CiviCRM Resources dashlet in the user's language
authorMathieu Lutfy <mathieu@symbiotic.coop>
Wed, 22 Jan 2020 22:38:32 +0000 (17:38 -0500)
committerMathieu Lutfy <mathieu@bidon.ca>
Wed, 22 Jan 2020 22:38:32 +0000 (17:38 -0500)
CRM/Dashlet/Page/GettingStarted.php
CRM/Utils/System.php

index 7ce121fa69eaacf25d2af163cdd0369977b1ab17..f09a490f7e86944eced5c847ce8ea63f7c8ef586 100644 (file)
@@ -72,13 +72,15 @@ class CRM_Dashlet_Page_GettingStarted extends CRM_Core_Page {
    * @return array
    */
   private function _gettingStarted() {
-    $value = Civi::cache('community_messages')->get('dashboard_gettingStarted');
+    $tsLocale = CRM_Core_I18n::getLocale();
+    $key = 'dashboard_gettingStarted_' . $tsLocale;
+    $value = Civi::cache('community_messages')->get($key);
 
     if (!$value) {
       $value = $this->_getHtml($this->gettingStartedUrl());
 
       if ($value) {
-        Civi::cache('community_messages')->set('dashboard_gettingStarted', $value, (60 * 60 * 24 * self::CACHE_DAYS));
+        Civi::cache('community_messages')->set($key, $value, (60 * 60 * 24 * self::CACHE_DAYS));
       }
     }
 
index c72f5ea8ebfccf6114fb6b8ab6b685340e32919e..29b043f1568eff6d62002f278ac4c0fdba52e5f6 100644 (file)
@@ -1786,13 +1786,14 @@ class CRM_Utils_System {
     }
     else {
       $config = CRM_Core_Config::singleton();
+      $tsLocale = CRM_Core_I18n::getLocale();
       $vars = [
         '{ver}' => CRM_Utils_System::version(),
         '{uf}' => $config->userFramework,
         '{php}' => phpversion(),
         '{sid}' => self::getSiteID(),
         '{baseUrl}' => $config->userFrameworkBaseURL,
-        '{lang}' => $config->lcMessages,
+        '{lang}' => $tsLocale,
         '{co}' => $config->defaultContactCountry,
       ];
       return strtr($url, array_map('urlencode', $vars));