From: Chris Burgess Date: Sat, 6 Jul 2013 04:39:41 +0000 (+1200) Subject: Lang code restructure from 1c9f455c, applied to Drupal6.php X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=cbb2e021b8fb7704b1cef9a1f1a915fe9abd95a1;p=civicrm-core.git Lang code restructure from 1c9f455c, applied to Drupal6.php --- diff --git a/CRM/Utils/System/Drupal6.php b/CRM/Utils/System/Drupal6.php index 0313007e5f..66a2d1999c 100644 --- a/CRM/Utils/System/Drupal6.php +++ b/CRM/Utils/System/Drupal6.php @@ -615,20 +615,26 @@ SELECT name, mail 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; - switch (TRUE) { - case $language->language == 'zh-hans': - return 'zh_CN'; - case $language->language == 'zh-hant': - return 'zh_TW'; + if (empty($language)) { + return NULL; + } - case preg_match('/^.._..$/', $language->language): - return $language->language; + if ($language->language == 'zh-hans') { + return 'zh_CN'; + } - default: - return CRM_Core_I18n_PseudoConstant::longForShort(substr($language->language, 0, 2)); + 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)); } function getVersion() {