I want to make it as simple as possible for our designers to localize strings in views, which means I want to do this:
... <p><?php echo $this->_("Hello, world!"); ?></p> ...
An underscore is needed here to allow Poedit to automatically extract all lines for localization. The implementation is trivial:
public function _($string) { return Zend_Registry::get('Zend_Translate')->_($string); }
At the moment, I put this directly in Zend_View_Abstract , which is bad (I do not want to do this by modifying any of the Zend library). Ideally, I would extend Zend_View_Abstract to allow me to implement other specific functions that we need, but I donβt know how to set it. An alternative might be to implement a view helper, but the only way I know how to do this makes the code in the view more verbose. Any pointers (no, not like that) would be much appreciated. Thanks!
php localization zend-framework
kranzky
source share