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