This documentation describes unreleased changes on the main branch.

_nx()

Twig function of the framework; its result is escaped like any value.

{{ _nx(singular, plural, number, context) }}

The singular or plural form of a text for a number in a context, translated.

<p>{{ _nx('%d seat', '%d seats', seats, 'free seats')|format(seats) }}</p>
ParameterTypeDefaultDescription
singularstringrequiredThe singular form in English.
pluralstringrequiredThe plural form in English.
numberintrequiredThe number that decides the form.
contextstringrequiredWhat the text means, for translators.

Returns string