當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Locale::getLanguageTranslationList方法代碼示例

本文整理匯總了PHP中Zend_Locale::getLanguageTranslationList方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Locale::getLanguageTranslationList方法的具體用法?PHP Zend_Locale::getLanguageTranslationList怎麽用?PHP Zend_Locale::getLanguageTranslationList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Locale的用法示例。


在下文中一共展示了Zend_Locale::getLanguageTranslationList方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: isValid

 /**
  * Validate the given value. Looks for the language translation list
  * in the registry (key 'Available_Languages'). If this key is not registered
  * the language list is obtained through a call to getLanguageTranslationList()
  * of Zend_Locale.
  *
  * @param string $value An enum string.
  * @return boolean True if the given enum string is known.
  */
 public function isValid($value)
 {
     if (false === is_array($value)) {
         $value = array($value);
     }
     $registry = Zend_Registry::getInstance();
     if ($registry->isRegistered('Available_Languages')) {
         $translationList = $registry->get('Available_Languages');
     } else {
         $locale = new Zend_Locale();
         $translationList = $locale->getLanguageTranslationList();
     }
     foreach ($value as $val) {
         $this->_setValue($val);
         if (is_string($val) === false) {
             $this->_error(self::MSG_LANGUAGE);
             return false;
         }
         if (array_key_exists($val, $translationList) === false) {
             $this->_error(self::MSG_LANGUAGE);
             return false;
         }
     }
     return true;
 }
開發者ID:alexukua,項目名稱:opus4,代碼行數:34,代碼來源:Language.php

示例2: testgetLanguageTranslationList

 /**
  * test getLanguageTranslationList
  * expected true
  */
 public function testgetLanguageTranslationList()
 {
     $value = new Zend_Locale();
     $list = $value->getLanguageTranslationList();
     $this->assertTrue(is_array($list));
     $list = $value->getLanguageTranslationList('de');
     $this->assertTrue(is_array($list));
 }
開發者ID:jon9872,項目名稱:zend-framework,代碼行數:12,代碼來源:LocaleTest.php


注:本文中的Zend_Locale::getLanguageTranslationList方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。