我渲染一些pluralization using the blocktrans tag;這裏的模板文件中的相關片段: {% blocktrans count choice_count=choice_count %}
You have {{ choice_count }} choice:
{% plural %}
You have {{ choice_count }} choi
我目前重定向到索引頁面的表單: {% for lang in LANGUAGES %}
<form name="setLang{{ lang.1 }}" action="/i18n/setlang/" method="post">
{% csrf_token %}
<input name="next" type="hidden" value="/"/>
當我嘗試在django模板中翻譯空字符串時,最終顯示的是po標題,而不是空字符串http://codex.wordpress.org/Translating_WordPress#The_PO_File_Header。 我必須翻譯空字符串,因爲它們是在db中我無法填充所有模型並將它們翻譯爲動態。 現在我使用類似 {% if data %}
{% trans data %}
{% endi