Please find a (working) proposal for translation of the title attribute
of the image form element.
Is this the right approach or do I need to specify elsewhere that this
has to be translated?
I guess a problem could arise because, for example, this test would fail
(assert->same($title, $image->getAttrib('title'))) if the title has been
translated...while being set.
It is also easy to override the render method and translate the title
attribute -if present- just before render.
Do I need a whole different approach or is either of the two ok?
Matthew? Jurrien?
/**
* Set the title (tooltip) for the image button. The tooltip will be
translated if a translator
* is available and not disabled.
*
* @param string $title
* @return provides a fluent interface
*/
public function setTitle($title){
// translate title (tooltip)
if (!$this->_translatorDisabled and $this->getTranslator()) {
$title = $this->getTranslator()->translate($title);
}
$this->setAttrib('title', $title);
return $this;
}
Bart McLeod schreef:
Hi all,
I am hesitating to file an issue about this, so I would like to know
if anyone of you already has done so, or maybe I am just mistaken.
If I use a Zend_Form_Element_Image to submit a form, I want a tooltip
on the image, so that users do not have to guess what the image button
does.
To my surprise, when I use the title attribute for the tooltip it does
not get translated, while every other label in the form and even
multioptions do get translated.
I have verified that translations are available for the tooltips in
the *.csv language file.
Anyone?
If it is by design, please let me know, if it is just forgotten, I
will file an issue and try to fix it.
Bart