I have a Zend_Form_Element_Select object, and about 3k select options. When the customer asked me to look further into optimization possibilities, I did some debug tracing, and noticed, that there were more than 3k calls to Zend_Form_Element_Multi->_translateValue and a little less to Zend_Form_Element_Multi->_translateOption . I found the option to set $elem->setDisableTranslator(true), which took care of these translations, for which I had no need. But the problem now is, that the error messages are no longer translated.
What I would like to know is, if there is a way to not translate values and options, but translate Validator messages?
I tried this:
foreach($operators->getValidators() as $val){
$val->setDisableTranslator(false);
}
but to no avail.
I don’t see any option within the element classes so the simple solution would be extending the
Zend_Form_Element_Selectclass with your own. Then you can override the_translateOptionsmethod as followsFurthermore, you can set some additional logic and options for this scenario, i.e. turn on/off translation for options.
If you want to eliminate this calls all together you will have to override the
getMultiOption()orgetMultiOptions()which are calling_translateOption().