Pass language code to CiviCRM
authorMatthew Wire <mjw@mjwconsult.co.uk>
Fri, 31 Jan 2020 16:17:54 +0000 (16:17 +0000)
committerMatthew Wire <mjw@mjwconsult.co.uk>
Fri, 31 Jan 2020 16:17:54 +0000 (16:17 +0000)
CRM/Utils/System/WordPress.php

index 595ad9ff2c5a1f1c63b32dc72ff52d96e43fab29..d1cbaec0872b4d20f01f1b55dfe6a6899f2e7b11 100644 (file)
@@ -417,8 +417,11 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base {
     elseif (defined('ICL_LANGUAGE_CODE')) {
       $language = ICL_LANGUAGE_CODE;
     }
-
-    // TODO: set language variable for others WordPress plugin
+    // Wordpress "standard" single language mode
+    // We still have to check if the function exists as it may not during bootstrap
+    elseif (function_exists('get_locale')) {
+      $language = get_locale();
+    }
 
     if (!empty($language)) {
       return CRM_Core_I18n_PseudoConstant::longForShort(substr($language, 0, 2));