任何人都知道我如何表现 entry/entries 正确地,在以下Genshi语法的片段中?

  <span py:if="c.page.item_count">
    ${c.page.item_count} entries.
  </span>

谢谢!

有帮助吗?

解决方案

不漂亮,但是应该工作

<span py:if="c.page.item_count">
  ${c.page.item_count} ${['entries','entry'][c.page.item_count==1]}.
</span>

或者

<span py:if="c.page.item_count">
  ${c.page.item_count} ${'entry' if c.page.item_count==1 else 'entries'}.
</span>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top