在Django中使用复数时人性化句子

时间:2013-11-22 12:46:57

标签: django django-templates pluralize

在使用Django模板复数过滤器的句子中定义is / are的最佳方法是什么? 例如:

<p>
    Your item{{ items|length|pluralize }}
    is/are
    currently being processed and will ship soon.
</p>

2 个答案:

答案 0 :(得分:8)

pluralize的最后一个示例所示,您可以尝试

Your item{{ items|length|pluralize:" is,s are" }}
currently being processed and will ship soon.

答案 1 :(得分:4)

pluralize与备用后缀参数一起使用。

<p>
    Your item{{ items|length|pluralize }}
    {{ items|length|pluralize:"is,are" }}
    currently being processed and will ship soon.
</p>