From 19780d2b853f0702c934006b11a29eb3259c7860 Mon Sep 17 00:00:00 2001 From: "Donald A. Lobo" Date: Tue, 8 Apr 2014 12:14:16 -0700 Subject: [PATCH] CRM-14390 - Inherit CMS language don't work in WordPress https://issues.civicrm.org/jira/browse/CRM-14390 --- CRM/Utils/System/WordPress.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CRM/Utils/System/WordPress.php b/CRM/Utils/System/WordPress.php index 389c2c0692..9c5a980bfb 100644 --- a/CRM/Utils/System/WordPress.php +++ b/CRM/Utils/System/WordPress.php @@ -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; + } } /** -- 2.25.1