mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-29 16:54:04 +02:00
Use the class namespace instead of the request in Form::translate(Plural)
refs #7551
This commit is contained in:
parent
e5d2d4cec2
commit
cf43b81400
@ -805,6 +805,20 @@ class Form extends Zend_Form
|
|||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the translation domain for this form
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function getTranslationDomain()
|
||||||
|
{
|
||||||
|
if (preg_match('@^Icinga\\\\Module\\\\([A-z]+)\\\\.*$@', get_called_class(), $matches) === 1) {
|
||||||
|
return strtolower($matches[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->getRequest()->getModuleName();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translate a string
|
* Translate a string
|
||||||
*
|
*
|
||||||
@ -815,7 +829,7 @@ class Form extends Zend_Form
|
|||||||
*/
|
*/
|
||||||
protected function translate($text, $context = null)
|
protected function translate($text, $context = null)
|
||||||
{
|
{
|
||||||
return Translator::translate($text, $this->request->getModuleName(), $context);
|
return Translator::translate($text, $this->getTranslationDomain(), $context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -834,7 +848,7 @@ class Form extends Zend_Form
|
|||||||
$textSingular,
|
$textSingular,
|
||||||
$textPlural,
|
$textPlural,
|
||||||
$number,
|
$number,
|
||||||
$this->request->getModuleName(),
|
$this->getTranslationDomain(),
|
||||||
$context
|
$context
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user