Translation: add a module-aware translation helper

With this fix $this->translate works in our view scripts

refs #6338
This commit is contained in:
Thomas Gelf 2014-05-27 21:41:46 +00:00
parent 886c8b1231
commit 360ac87550
2 changed files with 9 additions and 0 deletions

View File

@ -128,6 +128,9 @@ class ActionController extends Zend_Controller_Action
$this->windowId = $this->_request->getHeader('X-Icinga-WindowId', null);
}
$module = $request->getModuleName();
$this->view->translationDomain = $module === 'default' ? 'icinga' : $module;
if ($this->requiresConfig() === false) {
if ($this->requiresLogin() === false) {
$this->view->tabs = new Tabs();

View File

@ -31,6 +31,7 @@
namespace Icinga\Web;
use Icinga\Exception\ProgrammingError;
use Icinga\Util\Translator;
use Zend_View_Abstract;
use Closure;
@ -154,6 +155,11 @@ class View extends Zend_View_Abstract
);
}
public function translate($text)
{
return Translator::translate($text, $this->translationDomain);
}
/**
* Load helpers
*/