本文整理匯總了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;
}
示例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));
}