CRM-14390 - Inherit CMS language don't work in WordPress
authorDonald A. Lobo <lobo@civicrm.org>
Tue, 8 Apr 2014 19:14:16 +0000 (12:14 -0700)
committerDonald A. Lobo <lobo@civicrm.org>
Tue, 8 Apr 2014 19:14:16 +0000 (12:14 -0700)
https://issues.civicrm.org/jira/browse/CRM-14390

CRM/Utils/System/WordPress.php

index 389c2c06927d8f84687b5367bc196fddf1ec3e9f..9c5a980bfbfc28702e6b1e97f1b22da65268840d 100644 (file)
@@ -415,7 +415,18 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base {
    * @return string  with the locale or null for none
    */
   function getUFLocale() {
-    return NULL;
+    // WPML plugin
+    if (defined('ICL_LANGUAGE_CODE')) {
+      $language = ICL_LANGUAGE_CODE;
+    }
+
+    // TODO: set language variable for others WordPress plugin
+
+    if (isset($language)) {
+      return CRM_Core_I18n_PseudoConstant::longForShort(substr($language, 0, 2));
+    } else {
+      return NULL;
+    }
   }
 
   /**