In the Bootstrap file I added the following function:
protected function _initValidationTranslator() {
$translations = array();
$translations[Zend_Validate_Alnum::NOT_ALNUM] = '%value% trebuie sa fie format doar din litere si cifre';
$translator = new Zend_Translate('array', $translations);
Zend_Validate_Abstract::setDefaultTranslator($translator);
}
I hope this helps.
On Fri, Jun 19, 2009 at 15:27, Nicolas GREVET <ngrevet@alteo.fr> wrote:
You're not alone at all.
I'd find it particularily useful too, since I don't understand how we're supposed to override these messages the zend way.
Regards,
-- Nicolas
Neil Garb a écrit :
Hi ZF-MVC
Would anyone else find it useful to be able to change validator messages in a static context?
Use case:
I don't like 'Value is empty, but non-empty value is required' in Zend_Validate_NotEmpty
I specify in my controller's init() function: Zend_Validate_NotEmpty::setMessageTemplate('Please fill in this field', 'isEmpty');
This is most valuable for the notempty and inarray validators, which get instantiated automatically by the form validation routines.
- Neil
没有评论:
发表评论