QuickForm: translate() makes use of module name

This commit is contained in:
Thomas Gelf 2015-07-30 08:18:36 +02:00
parent 229902687a
commit 2bc57d459b

View File

@ -60,10 +60,13 @@ abstract class QuickForm extends Zend_Form
*/ */
protected $icingaModule; protected $icingaModule;
protected $icingaModuleName;
public function __construct($options = null) public function __construct($options = null)
{ {
if ($options !== null && array_key_exists('icingaModule', $options)) { if ($options !== null && array_key_exists('icingaModule', $options)) {
$this->icingaModule = $options['icingaModule']; $this->icingaModule = $options['icingaModule'];
$this->icingaModuleName = $this->icingaModule->getName();
unset($options['icingaModule']); unset($options['icingaModule']);
} }
parent::__construct($options); parent::__construct($options);
@ -254,8 +257,11 @@ abstract class QuickForm extends Zend_Form
public function translate($string) public function translate($string)
{ {
// TODO: A module should use it's own domain if ($this->icingaModuleName === null) {
return t($string); return t($string);
} else {
return mt($this->icingaModuleName, $string);
}
} }
public function onSuccess() public function onSuccess()