Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Won't Fix
-
Affects Version/s: 1.9.5
-
Fix Version/s: 1.10.0
-
Component/s: Zend_Validate
-
Labels:None
Description
If you specify a translated version of messages for errors in setDefaultTranslator($translator = null) (line 361), then it's impossible to overwrite it in execution's time.
The function _createMessage($messageKey, $value) (line 210) checks if there's a translated version of error message, but should also check if user has set an error's message during execution's time.
$validateStringLength = new Zend_Validate_StringLength(); $validateStringLength->setMin(1000)->setMessages(array( Zend_Validate_StringLength::TOO_SHORT => "Testing new error message" ));
The code above won't work if you have specified a translated version in Bootstrap.
All functions listed here are on file Zend_Validate_Abstract.
This can not work and will not be implemented.
Example:
You set an english error message.
You have activated translation/I18n.
Your user requests french translation.
But in your case the returned message is ALWAYS english as there would be no way to know which message has the same language as the requesting user and which has not and should be translated.
The solution:
When you activate translation then you must also set a translation for the validator which overrides the default/generic translation.
This will return the proper language, because when you don't set a new message, then the old default translation for this language will be returned.