1
我使用以下blocktrans使用blocktrans:翻譯
{% blocktrans with item|gender_text as gendertext %}
This is {{gendertext}} item
{% endblocktrans %}
在我的.po文件我有
msgid "This is %(gendertext)s item"
msgstr "Some translation ... %(gendertext)s"
除英語以外的任何語言,我不喜歡用gendertext
變量。所以,我希望有
msgstr "Some translation ..."
然而,當我脫下從%(gendertext)s
從msgstr
,django_admin長嘯(編譯消息時):
'msgstr' is not a valid Python format string, unlike 'msgid'. Reason: The string ends in the middle of a directive.
msgfmt: found 1 fatal error
任何變通辦法這種情況?
梅厄
把條件放在你的模板中對你不好? – sahid