X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FSystem%2FDrupalBase.php;h=6c1eebcd6b5351bf5eebfebdfbae4ecc4240879b;hb=ab943c063d345df099385ba90a58574e7a5ca9db;hp=b54b6761aba2565a27dc20295684dbb8c6d265f7;hpb=45ebc194fde140aadea85aee7a47d71ad25d1c7d;p=civicrm-core.git diff --git a/CRM/Utils/System/DrupalBase.php b/CRM/Utils/System/DrupalBase.php index b54b6761ab..6c1eebcd6b 100644 --- a/CRM/Utils/System/DrupalBase.php +++ b/CRM/Utils/System/DrupalBase.php @@ -1,9 +1,9 @@ getCurrentLanguage(); if (empty($language)) { return NULL; } - if ($language->language == 'zh-hans') { + if ($language == 'zh-hans') { return 'zh_CN'; } - if ($language->language == 'zh-hant') { + if ($language == 'zh-hant') { return 'zh_TW'; } - if (preg_match('/^.._..$/', $language->language)) { - return $language->language; + if (preg_match('/^.._..$/', $language)) { + return $language; } - return CRM_Core_I18n_PseudoConstant::longForShort(substr($language->language, 0, 2)); + return CRM_Core_I18n_PseudoConstant::longForShort(substr($language, 0, 2)); } /** @@ -664,4 +664,14 @@ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base { } } + /** + * Function to return current language of Drupal + * + * @return string + */ + public function getCurrentLanguage() { + global $language; + return (!empty($language->language)) ? $language->language : $language; + } + }