Skip to content

Commit 7068ddc

Browse files
RedundancyGroup: Don't wrap state msg into span and translate it with context
This msg should be handled same as the host <is/on> word, no element wrapping. This way, the margin arround the msg is applied properly.
1 parent aa33908 commit 7068ddc

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

library/Icingadb/Widget/Detail/RedundancyGroupHeader.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Icinga\Module\Icingadb\Model\RedundancyGroupSummary;
99
use Icinga\Module\Icingadb\Widget\DependencyNodeStatistics;
1010
use ipl\Html\BaseHtmlElement;
11+
use ipl\Html\Html;
1112
use ipl\Html\HtmlElement;
1213
use ipl\Html\Text;
1314
use ipl\Web\Widget\StateBall;
@@ -37,14 +38,18 @@ protected function assembleVisual(BaseHtmlElement $visual): void
3738

3839
protected function assembleTitle(BaseHtmlElement $title): void
3940
{
40-
$title->addHtml($this->createSubject());
41+
$subject = $this->createSubject();
4142
if ($this->object->state->failed) {
42-
$text = $this->translate('has no working objects');
43+
$title->addHtml(Html::sprintf(
44+
$this->translate('%s has no working objects', '<groupname> has ...'),
45+
$subject
46+
));
4347
} else {
44-
$text = $this->translate('has working objects');
48+
$title->addHtml(Html::sprintf(
49+
$this->translate('%s has working objects', '<groupname> has ...'),
50+
$subject
51+
));
4552
}
46-
47-
$title->addHtml(HtmlElement::create('span', null, Text::create($text)));
4853
}
4954

5055
protected function createStatistics(): BaseHtmlElement

library/Icingadb/Widget/ItemList/RedundancyGroupListItem.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Icinga\Module\Icingadb\Model\RedundancyGroupState;
1313
use Icinga\Module\Icingadb\Widget\DependencyNodeStatistics;
1414
use ipl\Html\BaseHtmlElement;
15+
use ipl\Html\Html;
1516
use ipl\Stdlib\Filter;
1617
use ipl\Web\Url;
1718
use ipl\Web\Widget\Link;
@@ -80,14 +81,18 @@ protected function assembleCaption(BaseHtmlElement $caption): void
8081

8182
protected function assembleTitle(BaseHtmlElement $title): void
8283
{
83-
$title->addHtml($this->createSubject());
84+
$subject = $this->createSubject();
8485
if ($this->state->failed) {
85-
$text = $this->translate('has no working objects');
86+
$title->addHtml(Html::sprintf(
87+
$this->translate('%s has no working objects', '<groupname> has ...'),
88+
$subject
89+
));
8690
} else {
87-
$text = $this->translate('has working objects');
91+
$title->addHtml(Html::sprintf(
92+
$this->translate('%s has working objects', '<groupname> has ...'),
93+
$subject
94+
));
8895
}
89-
90-
$title->addHtml(HtmlElement::create('span', null, Text::create($text)));
9196
}
9297

9398
protected function assemble(): void

0 commit comments

Comments
 (0)