本文整理匯總了PHP中Zend_View_Interface::translate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_View_Interface::translate方法的具體用法?PHP Zend_View_Interface::translate怎麽用?PHP Zend_View_Interface::translate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_View_Interface
的用法示例。
在下文中一共展示了Zend_View_Interface::translate方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: isValid
/**
* Make sure the user is valid
*
* @return void
*/
public function isValid($value)
{
$valid = true;
$this->_user = $value;
$namePartsValidator = new Zend_Validate();
$namePartsValidator->addValidator(new Zend_Validate_NotEmpty(Zend_Validate_NotEmpty::STRING))->addValidator(new Zend_Validate_Alpha(array('allowWhiteSpace' => true)))->addValidator(new Zend_Validate_StringLength(array('min' => 2)));
if (!$namePartsValidator->isValid($this->_user->getFirstName())) {
$valid = false;
$this->_error($this->_view->translate('The first name must have at least 2 characters and consist only of letters'));
}
if (!$namePartsValidator->isValid($this->_user->getLastName())) {
$valid = false;
$this->_error($this->_view->translate('The last name must have at least 2 characters and consist only of letters'));
}
$emailValidator = new Zend_Validate_EmailAddress();
if (!$emailValidator->isValid($this->_user->getEmail())) {
$valid = false;
$this->_error($this->_view->translate('You must entre a valid email'));
}
if ($this->_user->isNew()) {
$usernameValidator = new Zend_Validate();
$usernameValidator->addValidator(new Zend_Validate_NotEmpty(Zend_Validate_NotEmpty::STRING))->addValidator(new Zend_Validate_Alnum(array('allowWhiteSpace' => false)))->addValidator(new Zend_Validate_StringLength(array('min' => 5)));
if (!$usernameValidator->isValid($this->_user->getUsername())) {
$this->_error($this->_view->translate('The username must have at least 5 characters and contains no white spaces'));
}
}
return $valid;
}
示例2: render
public function render(Zend_View_Interface $view = null, $element = null)
{
$this->_randomPointer();
return $view->translate($this->_createMessage(self::LABEL, null), $this->getPointer()) . ' <b>' . $this->getWord() . '</b>';
}