Plural form of words

How to convert a word into a plural form in Anqi CMS template based on quantity?

pluralizeA filter can convert a word into a plural form based on the quantity.

How to use

pluralizeHow to use filters:

{{ obj|pluralize:"plural additional words" }}

pluralizeYou need to specify the current number and add plural words. Supports 0 to 2 words, use when 2 words,Separate.

for examplecustomer, you can write it like this:

customer{{ 1|pluralize }}
# Show results
customer

Sample Demo

customer{{ 0|pluralize }}
customer{{ 1|pluralize }}
customer{{ 2|pluralize }}
cherr{{ 0|pluralize:"y,ies" }}
cherr{{ 1|pluralize:"y,ies" }}
cherr{{ 2|pluralize:"y,ies" }}
walrus{{ 0|pluralize:"es" }}
walrus{{ 1|pluralize:"es" }}
walrus{{ simple.number|pluralize:"es" }}
# 显示结果
customers
customer
customers
cherries
cherry
cherries
walruses
walrus
walruses