WP_Translations::translate_plural( string|null $singular, string|null $plural, int|float $count = 1, string|null $context =  ): string|null

In this article

Translates a plural string.

Parameters

$singularstring|nullrequired
Singular string.
$pluralstring|nullrequired
Plural string.
$countint|floatoptional
Count. Should be an integer, but some plugins pass floats.

Default:1

$contextstring|nulloptional
Context.

Default:''

Return

string|null Translation if it exists, or the unchanged singular string.

Source

public function translate_plural( $singular, $plural, $count = 1, $context = '' ) {
	if ( null === $singular || null === $plural ) {
		return $singular;
	}

	$translation = $this->controller->translate_plural( array( $singular, $plural ), (int) $count, (string) $context, $this->textdomain );
	if ( false !== $translation ) {
		return $translation;
	}

	// Fall back to the original with English grammar rules.
	return ( 1 === $count ? $singular : $plural );
}

Changelog

VersionDescription
6.5.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.