Merge pull request #2843 from kurund/CRM-14427
[civicrm-core.git] / 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;
+    }
   }
 
   /**