Beispiel #1
0
 /**
  * @inheritDoc
  */
 public function getUFLocale()
 {
     // 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;
     }
 }
 /**
  * Get the locale set in the hosting CMS
  *
  * @return string  with the locale or null for none
  */
 function getUFLocale()
 {
     // return CiviCRM’s xx_YY locale that either matches Drupal’s Chinese locale
     // (for CRM-6281), Drupal’s xx_YY or is retrieved based on Drupal’s xx
     // sometimes for CLI based on order called, this might not be set and/or empty
     global $language;
     if (empty($language)) {
         return NULL;
     }
     if ($language->language == 'zh-hans') {
         return 'zh_CN';
     }
     if ($language->language == 'zh-hant') {
         return 'zh_TW';
     }
     if (preg_match('/^.._..$/', $language->language)) {
         return $language->language;
     }
     return CRM_Core_I18n_PseudoConstant::longForShort(substr($language->language, 0, 2));
 }
 /**
  * Get the locale set in the hosting CMS
  *
  * @return string  with the locale or null for none
  */
 function getUFLocale()
 {
     // return CiviCRM’s xx_YY locale that either matches Drupal’s Chinese locale
     // (for CRM-6281), Drupal’s xx_YY or is retrieved based on Drupal’s xx
     global $language;
     switch (TRUE) {
         case $language->language == 'zh-hans':
             return 'zh_CN';
         case $language->language == 'zh-hant':
             return 'zh_TW';
         case preg_match('/^.._..$/', $language->language):
             return $language->language;
         default:
             return CRM_Core_I18n_PseudoConstant::longForShort(substr($language->language, 0, 2));
     }
 }