WP_CLI\Utils

pluralize()WP-CLI 1.0

Pluralizes a noun in a grammatically correct way.

No Hooks.

Return

String. Pluralized noun.

Usage

pluralize( $noun, $count );
$noun(string) (required)
Noun to be pluralized. Needs to be in singular form.
$count(int|null)
Count of the nouns, to decide whether to pluralize. Will pluralize unconditionally if none provided.
Default: null

pluralize() code WP-CLI 2.8.0-alpha

function pluralize( $noun, $count = null ) {
	if ( 1 === $count ) {
		return $noun;
	}

	return Inflector::pluralize( $noun );
}