Skip to main content

ngettext

Returns the singular or plural form of a string based on the provided number.

def ngettext(
singular: string,
plural: string,
number: integer
) - > string

Selects between a singular and plural string based on a provided numeric value.

Parameters

NameTypeDescription
singularstringThe string to return when the count represents a single item.
pluralstringThe string to return when the count represents multiple items (not equal to 1).
numberintegerThe numeric value used to determine which string form to select.

Returns

TypeDescription
stringThe singular string if the number is 1, otherwise the plural string.