_n

SummerySummery

Translates and retrieves the singular or plural form based on the supplied number.

Syntax

_n( string $single, string $plural, int $number, string $domain = 'default' )

DescriptionDescription

Used when you want to use the appropriate form of a string based on whether a number is singular or plural.

Example:

printf( _n( '%s person', '%s people', $count, 'text-domain' ), number_format_i18n( $count ) );

ParametersParameters

$single

(string) (Required) The text to be used if the number is singular.

$plural

(string) (Required) The text to be used if the number is plural.

$number

(int) (Required) The number to compare against to use either the singular or plural form.

$domain

(string) (Optional) Text domain. Unique identifier for retrieving translated strings.

Default value: 'default'

ReturnReturn

(string) The translated singular or plural form.

SourceSource

File: wp-includes/l10n.php


			

ChangelogChangelog

Changelog
Version Description
2.8.0 Introduced.
Scroll to Top