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

Translates a plural string.


Parameters

$singular

(string|null) (Required) Singular string.

$plural

(string|null) (Required) Plural string.

$count

(int|float) (Optional) Count. Should be an integer, but some plugins pass floats.

Default value: 1

$context

(string|null) (Optional) Context.

Default value: ''


Return

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


Source

File: wp-includes/l10n/class-wp-translations.php

	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

Changelog
Version Description
6.5.0 Introduced.