Add gettext plural
This commit is contained in:
parent
572f544bab
commit
811823cc95
2 changed files with 20 additions and 2 deletions
|
@ -6,7 +6,7 @@
|
|||
* @author Jay Trees <github.jay@grandel.anonaddy.me>
|
||||
*/
|
||||
|
||||
function __(string $text)
|
||||
function __(string $text): string
|
||||
{
|
||||
global $translations;
|
||||
|
||||
|
@ -22,3 +22,8 @@ function __(string $text)
|
|||
|
||||
return htmlentities($text);
|
||||
}
|
||||
|
||||
function _n(string $singular, string $plural, int $amount): string
|
||||
{
|
||||
return 1 === $amount ? __($singular) : __($plural);
|
||||
}
|
||||
|
|
|
@ -317,7 +317,20 @@ $page->navigation();
|
|||
<div class="bar">
|
||||
<div class="progress"></div>
|
||||
</div>
|
||||
<div class="label"><?= sprintf(__('%d more subscriber(s) needed'), $count_users_5 - $count_users_rc) ?></div>
|
||||
<div class="label">
|
||||
<?php
|
||||
$count_users_needed = $count_users_5 - $count_users_rc;
|
||||
|
||||
printf(
|
||||
_n(
|
||||
'%d more subscriber needed',
|
||||
'%d more subscribers needed',
|
||||
$count_users_needed
|
||||
),
|
||||
$count_users_needed
|
||||
)
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
|
Loading…
Reference in a new issue