Skip to content

Commit

Permalink
StateListItem: Use Translator::translatePlural() to translate affec…
Browse files Browse the repository at this point in the history
…ted objects tooltip
  • Loading branch information
raviks789 committed Oct 15, 2024
1 parent 08ac0b0 commit 1720b7c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions library/Icingadb/Widget/ItemList/StateListItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,13 @@ protected function assembleTitle(BaseHtmlElement $title): void
));

if ($this->state->affects_children) {
$total = $this->item->affected_children;
$total = (int) $this->item->affected_children;

if ((int) $total > 1000) {
if ($total > 1000) {
$total = '1000+';
$tooltip = t('Up to 1000+ affected objects');
} else {
$tooltip = sprintf(tp('%d affected object', 'Up to %d affected objects', $total), $total);
}

$icon = new Icon(Icons::UNREACHABLE);
Expand All @@ -108,7 +111,7 @@ protected function assembleTitle(BaseHtmlElement $title): void
'span',
Attributes::create([
'class' => 'affected-objects',
'title' => sprintf(t('Up to %s affected objects'), $total)
'title' => $tooltip
]),
$icon,
Text::create($total)
Expand Down

0 comments on commit 1720b7c

Please sign in to comment.