4
定義一個句子中使用Django模板複數形式過濾器的最佳方式是什麼? 例如:在Django中使用複數形式時的人性化傾向
<p>
Your item{{ items|length|pluralize }}
is/are
currently being processed and will ship soon.
</p>
定義一個句子中使用Django模板複數形式過濾器的最佳方式是什麼? 例如:在Django中使用複數形式時的人性化傾向
<p>
Your item{{ items|length|pluralize }}
is/are
currently being processed and will ship soon.
</p>
如在pluralize
最後一個例子所示,你可以嘗試
Your item{{ items|length|pluralize:" is,s are" }}
currently being processed and will ship soon.
使用pluralize
具有替代後綴參數。
<p>
Your item{{ items|length|pluralize }}
{{ items|length|pluralize:"is,are" }}
currently being processed and will ship soon.
</p>