parent
fa226f261e
commit
e5d2d4cec2
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
namespace Icinga\Util;
|
namespace Icinga\Util;
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use Icinga\Exception\IcingaException;
|
use Icinga\Exception\IcingaException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,7 +63,7 @@ class Translator
|
||||||
*
|
*
|
||||||
* @param string $textSingular The string in singular form to translate
|
* @param string $textSingular The string in singular form to translate
|
||||||
* @param string $textPlural The string in plural form to translate
|
* @param string $textPlural The string in plural form to translate
|
||||||
* @param integer $number The number to get the plural or singular string
|
* @param integer $number The amount to determine from whether to return singular or plural
|
||||||
* @param string $domain The primary domain to use
|
* @param string $domain The primary domain to use
|
||||||
* @param string|null $context Optional parameter for context based translation
|
* @param string|null $context Optional parameter for context based translation
|
||||||
*
|
*
|
||||||
|
|
|
@ -9,6 +9,7 @@ use Zend_Config;
|
||||||
use Zend_Form;
|
use Zend_Form;
|
||||||
use Zend_View_Interface;
|
use Zend_View_Interface;
|
||||||
use Icinga\Application\Icinga;
|
use Icinga\Application\Icinga;
|
||||||
|
use Icinga\Util\Translator;
|
||||||
use Icinga\Web\Form\Decorator\NoScriptApply;
|
use Icinga\Web\Form\Decorator\NoScriptApply;
|
||||||
use Icinga\Web\Form\Element\CsrfCounterMeasure;
|
use Icinga\Web\Form\Element\CsrfCounterMeasure;
|
||||||
|
|
||||||
|
@ -804,6 +805,40 @@ class Form extends Zend_Form
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translate a string
|
||||||
|
*
|
||||||
|
* @param string $text The string to translate
|
||||||
|
* @param string|null $context Optional parameter for context based translation
|
||||||
|
*
|
||||||
|
* @return string The translated string
|
||||||
|
*/
|
||||||
|
protected function translate($text, $context = null)
|
||||||
|
{
|
||||||
|
return Translator::translate($text, $this->request->getModuleName(), $context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translate a plural string
|
||||||
|
*
|
||||||
|
* @param string $textSingular The string in singular form to translate
|
||||||
|
* @param string $textPlural The string in plural form to translate
|
||||||
|
* @param integer $number The amount to determine from whether to return singular or plural
|
||||||
|
* @param string|null $context Optional parameter for context based translation
|
||||||
|
*
|
||||||
|
* @return string The translated string
|
||||||
|
*/
|
||||||
|
protected function translatePlural($textSingular, $textPlural, $number, $context = null)
|
||||||
|
{
|
||||||
|
return Translator::translatePlural(
|
||||||
|
$textSingular,
|
||||||
|
$textPlural,
|
||||||
|
$number,
|
||||||
|
$this->request->getModuleName(),
|
||||||
|
$context
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render this form
|
* Render this form
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue