Translation: add a module-aware translation helper
With this fix $this->translate works in our view scripts refs #6338
This commit is contained in:
parent
886c8b1231
commit
360ac87550
|
@ -128,6 +128,9 @@ class ActionController extends Zend_Controller_Action
|
||||||
$this->windowId = $this->_request->getHeader('X-Icinga-WindowId', null);
|
$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->requiresConfig() === false) {
|
||||||
if ($this->requiresLogin() === false) {
|
if ($this->requiresLogin() === false) {
|
||||||
$this->view->tabs = new Tabs();
|
$this->view->tabs = new Tabs();
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
namespace Icinga\Web;
|
namespace Icinga\Web;
|
||||||
|
|
||||||
use Icinga\Exception\ProgrammingError;
|
use Icinga\Exception\ProgrammingError;
|
||||||
|
use Icinga\Util\Translator;
|
||||||
use Zend_View_Abstract;
|
use Zend_View_Abstract;
|
||||||
use Closure;
|
use Closure;
|
||||||
|
|
||||||
|
@ -154,6 +155,11 @@ class View extends Zend_View_Abstract
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function translate($text)
|
||||||
|
{
|
||||||
|
return Translator::translate($text, $this->translationDomain);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load helpers
|
* Load helpers
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue