mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2026-05-28 04:34:08 -04:00
QuickBaseForm: Replace method translate with trait
The trait provides translatePlural method.
This commit is contained in:
parent
2dbfe86f16
commit
3612f3202b
2 changed files with 12 additions and 16 deletions
|
|
@ -56,14 +56,16 @@ class CleanupNodeForm extends BpConfigBaseForm
|
|||
$changes->deleteNode($node);
|
||||
}
|
||||
|
||||
$count = count($nodesToCleanup);
|
||||
if ($count === 1) {
|
||||
$successMsg = sprintf($this->translate('Successfully removed missing node %s'), $nodeName);
|
||||
} else {
|
||||
$successMsg = sprintf($this->translate('Successfully removed %d missing nodes'), $count);
|
||||
}
|
||||
|
||||
$this->setSuccessMessage($successMsg);
|
||||
$count = count($nodesToCleanup);
|
||||
$this->setSuccessMessage(sprintf(
|
||||
$this->translatePlural(
|
||||
'Successfully removed missing node %s',
|
||||
'Successfully removed %d missing nodes',
|
||||
$count
|
||||
),
|
||||
$count === 1 ? $nodeName : $count
|
||||
));
|
||||
|
||||
unset($changes);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,10 +5,13 @@ namespace Icinga\Module\Businessprocess\Web\Form;
|
|||
use Icinga\Application\Icinga;
|
||||
use Icinga\Application\Modules\Module;
|
||||
use ipl\Html\ValidHtml;
|
||||
use ipl\I18n\Translation;
|
||||
use Zend_Form;
|
||||
|
||||
abstract class QuickBaseForm extends Zend_Form implements ValidHtml
|
||||
{
|
||||
use Translation;
|
||||
|
||||
/**
|
||||
* The Icinga module this form belongs to. Usually only set if the
|
||||
* form is initialized through the FormLoader
|
||||
|
|
@ -154,13 +157,4 @@ abstract class QuickBaseForm extends Zend_Form implements ValidHtml
|
|||
|
||||
return strlen($value) === 0;
|
||||
}
|
||||
|
||||
public function translate($string)
|
||||
{
|
||||
if ($this->icingaModuleName === null) {
|
||||
return t($string);
|
||||
} else {
|
||||
return mt($this->icingaModuleName, $string);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue