Thomas, I understand your point. But the issue we have with
Zend_Validate is that it injects values into the messages -- which means
that the message strings are not reliable. Are you suggesting that we
use them anyways, instead of the validation error constants?

The proper way of translating exceptions (or error messages) is to have value and message seperated.
The exception class has to be extended to provide this functionality.

See Zend_Date_Exception for an example where the operand can be returned explicit from the exception itself.
What we need for Zend_Validate is
* returned exception with value as already done
* new function which returns the original exception without replacing the internal parameter
* and a function which returns the values to replace

This would not break backward compatibility.
Another way would be to force unique keys within the complete framework.
But this has not been done in past so we have a problem as soon as I18N comes to work.

The problem in our case is that the error-constants have to be unique even when taking other components in account. There is no way to provide a translation when 2 different components use the same messageid.
I think the above change would make this possible.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

Reply via email to