ZF-6724: Error with options count in Zend_View_Helper_Translate
In the public function translate of Zend_View_Helper_Translate the options count should be updated after every change in options array. This is not really the case. This can lead into problems with the last return "return vsprintf($message, $options)".
As an example i have a messageId like 'translate-me' which should be translated into two languages.
de - translate-me = 'Dies ist 100%tig übersetzt' en - translate-me = 'This is 100% translated'
The % in both aren't placeholders for vsprintf, they are just what they are.
So if I show both translations on one site for translation purposes, I'll render them in a view with $this->translate('translate-me','de') and $this->translate('translate-me','en').
Now the bug comes into game. The translate function won't return the translation, it will throw an Exception "Warning: vsprintf() [function.vsprintf]: Too few arguments in...".
What happened is that the $count variable in the translate function is fixed to options count value before the locale is popped of the end of the options array. The $count value is used for deciding return the translated message if it's 0, but in this case it cant be 0. So the function goas by and tries to return it as a vsprintf string. but there are no more options (the locale gets popped of the options).
I'll provide a patch which should fix this without affecting anything else :)