public static function translatePlural(string $singular, string $plural, $number, ...$text): string
    {
        if (\function_exists('ngettext')) {
            $message = ngettext($singular, $plural, $number);
        } else {
            $message = $singular;
        }

        if (\func_num_args() > 3) {
            // first element is number
            array_unshift($text, $number);
            $message = vsprintf($message, $text);
        }

        return $message;
    }
public static function translatePlural(string $singular, string $plural, $number, ...$text): string
    {
        if (\function_exists('ngettext')) {
            $message = ngettext($singular, $plural, $number);
        } else {
            $message = $singular;
        }

        if (\func_num_args() > 3) {
            // first element is number
            array_unshift($text, $number);
            $message = vsprintf($message, $text);
        }

        return $message;
    }
public static function translatePlural ( string $ singular , string $ plural , $ number , ... $ text ) : string { if ( \ function_exists ( 'ngettext' ) ) { $ message = ngettext ( $ singular , $ plural , $ number ) ; } else { $ message = $ singular ; } if ( \ func_num_args ( ) > 3 ) { // first element is number array_unshift ( $ text , $ number ) ; $ message = vsprintf ( $ message , $ text ) ; } return $ message ; }
Translate plural form

Example of usage plural form + sprintf
equal to sprintf(ngettext('%d comment', '%d comments', 4), 4)
Translator::translatePlural('%d comment', '%d comments', 4)

Example of usage plural form + sprintf
equal to sprintf(ngettext('%d comment', '%d comments', 4), 4, 'Topic')
Translator::translatePlural('%d comment to %s', '%d comments to %s', 4, 'Topic')

@param  string   $singular
@param  string   $plural
@param  integer  $number
@param  string[] ...$text

@return string
@link   http://docs.translatehouse.org/projects/localization-guide/en/latest/l10n/pluralforms.html
Translate plural form