Add more support to plural strings translation

Add more support to plural strings translation

refs #8092
This commit is contained in:
Carlos Cesario 2014-12-16 09:31:20 -02:00
parent 08473ff5c9
commit d4bbd3a323
3 changed files with 17 additions and 12 deletions

View File

@ -6,7 +6,7 @@
<?= $this->translate('No hosts matching the filter') ?>
<?php else: ?>
<div class="hbox-item">
<b><?= sprintf($this->translate('Hosts (%u)'), array_sum(array_values($hostStates))) ?></b>
<b><?= sprintf($this->translatePlural('Host (%u)', 'Hosts (%u)', array_sum(array_values($hostStates))), array_sum(array_values($hostStates))) ?></b>
</div>
<div class="hbox-item">
<?= $this->hostStatesPieChart ?>
@ -18,9 +18,14 @@
</div>
<h3>
<?= sprintf($this->translate('%u Hosts'),
count($objects))
?>
<?= sprintf(
$this->translatePlural(
'%u Host',
'%u Hosts',
count($objects)
),
count($objects)
) ?>
</h3>
<div>
@ -102,7 +107,7 @@
<a href="<?= $inDowntimeLink ?>"
title="<?= $this->translate('Hosts in downtime') ?>">
<?= $this->icon('plug') ?>
<?= $this->translate(sprintf('%u hosts are in downtime', count($objectsInDowntime))) ?>
<?= sprintf($this->translatePlural('%u host is in downtime', '%u hosts are in downtime', count($objectsInDowntime)),count($objectsInDowntime)) ?>
</a>
</h2>
<?php endif ?>
@ -112,7 +117,7 @@
<a href="<?= $havingCommentsLink ?>"
title="<?= $this->translate('Comments') ?>">
<?= $this->icon('comment') ?>
<?= $this->translate(sprintf('%u comments', count($objects->getComments()))) ?>
<?= sprintf($this->translatePlural('%u comment', '%u comments', count($objects->getComments())), count($objects->getComments())) ?>
</a>
</h2>
<?php endif ?>

View File

@ -3,7 +3,7 @@
$objectName = $this->is_service ? 'Services' : 'Hosts';
?><tr class="newsection" data-base-target="_next">
<th><a href=<?= count($comments) ?> <?= $this->translate('Comments') ?></th>
<th><a href=<?= sprintf($this->translatePlural('%u Comment', '%u Comments', count($comments)), count($comments)) ?></th>
<td>
<a href="<?= $this->href('monitoring/command/removecomment', $this->target) ?>"><?=
$this->icon('cancel')
@ -20,6 +20,6 @@ $objectName = $this->is_service ? 'Services' : 'Hosts';
'monitoring/list/comments',
array('comment_internal_id' => '(' . implode('|', $this->comments) . ')')
);
?>"> <?= count($comments) ?> comments </a>.
?>"> <?= sprintf($this->translatePlural('%u comment', '%u comments', count($comments)), count($comments)) ?></a>.
</td>
</tr>

View File

@ -8,7 +8,7 @@
<div class="hbox">
<div class="hbox-item" style="width: 6em;">
<b><?= sprintf($this->translate('Services (%u)'), array_sum(array_values($serviceStates))) ?></b>
<b><?= sprintf($this->translatePlural('Service (%u)', 'Services (%u)', array_sum(array_values($serviceStates))), array_sum(array_values($serviceStates))) ?></b>
</div>
<div class="hbox-item">
<?= $this->serviceStatesPieChart ?>
@ -22,7 +22,7 @@
<div class="hbox">
<div class="hbox-item" style="width: 6em;">
<b><?= sprintf($this->translate('Hosts (%u)'), array_sum(array_values($hostStates))) ?></b>
<b><?= sprintf($this->translatePlural('Host (%u)', 'Hosts (%u)', array_sum(array_values($hostStates))), array_sum(array_values($hostStates))) ?></b>
</div>
<div class="hbox-item">
<?= $this->hostStatesPieChart ?>
@ -114,7 +114,7 @@
<a href="<?= $inDowntimeLink ?>"
title="<?= $this->translate('Services in downtime') ?>">
<?= $this->icon('plug') ?>
<?= $this->translate(sprintf('%u services are in downtime', count($objectsInDowntime))) ?>
<?= sprintf($this->translatePlural('%u service is in downtime', '%u services are in downtime', count($objectsInDowntime)), count($objectsInDowntime)) ?>
</a>
</h2>
<?php endif ?>
@ -124,7 +124,7 @@
<a href="<?= $havingCommentsLink ?>"
title="<?= $this->translate('Comments') ?>">
<?= $this->icon('comment') ?>
<?= $this->translate(sprintf('%u comments', count($objects->getComments()))) ?>
<?= sprintf($this->translatePlural('%u comment', '%u comments', count($objects->getComments())), count($objects->getComments())) ?>
</a>
</h2>
<?php endif ?>