I want to make it as easy as possible for our designers to localise strings in views, which means that I want to do this:
...
<p><?php echo $this->_("Hello, world!"); ?></p>
...
The underscore notation here is necessary to allow Poedit to automagically extract all strings for localisation. The implementation is trivial:
public function _($string)
{
return Zend_Registry::get('Zend_Translate')->_($string);
}
At the moment, I've put this directly in Zend_View_Abstract
, which is bad (I don't want to do this by modifying any of the Zend library). Ideally, then, I'd extend Zend_View_Abstract
to allow me to implement other concrete functions that we require, but I don't know how to set this up. An alternative might be to implement a View Helper, but the only way that I know how to do this makes the code in the view more verbose. Any pointers (no, not those kind) would be much appreciated. Thanks!