5

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

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

2 回答 2

9

如上一个示例所示pluralize,您可以尝试

Your item{{ items|length|pluralize:" is,s are" }}
currently being processed and will ship soon.
于 2013-11-22T12:51:52.767 回答
4

使用pluralizewith Alternative suffix 参数。

<p>
    Your item{{ items|length|pluralize }}
    {{ items|length|pluralize:"is,are" }}
    currently being processed and will ship soon.
</p>
于 2013-11-22T12:50:23.957 回答