Host-|ServiceSummaryDonut: Make the *Total 42* label properly localizable

refs https://github.com/Icinga/ipl-html/issues/33
This commit is contained in:
Johannes Meyer 2021-05-26 16:02:13 +02:00
parent 016b9f3f17
commit 1bbbaa96ce
2 changed files with 12 additions and 10 deletions

View file

@ -10,9 +10,9 @@ use Icinga\Module\Icingadb\Common\BaseFilter;
use Icinga\Module\Icingadb\Common\Links;
use Icinga\Module\Icingadb\Model\HoststateSummary;
use ipl\Html\BaseHtmlElement;
use ipl\Html\Html;
use ipl\Html\HtmlElement;
use ipl\Html\HtmlString;
use ipl\Html\TemplateString;
use ipl\Web\Filter\QueryString;
class HostSummaryDonut extends Card
@ -61,10 +61,11 @@ class HostSummaryDonut extends Card
{
$header->add([
new HtmlElement('h2', null, t('Hosts')),
Html::tag('span', ['class' => 'meta'], [
Html::tag('span', t('Total')),
' ' . $this->summary->hosts_total
])
new HtmlElement('span', ['class' => 'meta'], TemplateString::create(
t('{{#total}}Total{{/total}} %d'),
['total' => new HtmlElement('span')],
(int) $this->summary->hosts_total
))
]);
}
}

View file

@ -10,9 +10,9 @@ use Icinga\Module\Icingadb\Common\BaseFilter;
use Icinga\Module\Icingadb\Common\Links;
use Icinga\Module\Icingadb\Model\ServicestateSummary;
use ipl\Html\BaseHtmlElement;
use ipl\Html\Html;
use ipl\Html\HtmlElement;
use ipl\Html\HtmlString;
use ipl\Html\TemplateString;
use ipl\Web\Filter\QueryString;
class ServiceSummaryDonut extends Card
@ -63,10 +63,11 @@ class ServiceSummaryDonut extends Card
{
$header->add([
new HtmlElement('h2', null, t('Services')),
Html::tag('span', ['class' => 'meta'], [
Html::tag('span', t('Total')),
' ' . $this->summary->services_total
])
new HtmlElement('span', ['class' => 'meta'], TemplateString::create(
t('{{#total}}Total{{/total}} %d'),
['total' => new HtmlElement('span')],
(int) $this->summary->services_total
))
]);
}
}