本文整理汇总了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));
}