根據Django文檔中的this section,我應該使用{% blocktrans %}
來處理需要翻譯複數的情況。然而,像下面這樣的例子,我能做些什麼更方便嗎?Django模板{%trans%}多元化
{% blocktrans count video.views.count as views %}
The video has been viewed <span>{{ views }}</span> time
{% plural %}
The video has been viewed <span>{{ views }}</span> times
{% endblocktrans %}
我試着做到以下幾點:
{% blocktrans %}time{% plural %}times{% endblocktrans %}
但它扔TemplateSyntaxError: 'blocktrans' doesn't allow other block tags (seen u'plural') inside it
這使得它非常難翻譯,因爲你是強迫的話排序;如果翻譯需要在「{{views}}」前面有複數形式,該怎麼辦?詳細的表達式真的是要走的路。 – bouke 2013-01-18 08:03:04