【发布时间】:2020-04-04 11:14:45
【问题描述】:
我已经在这个项目中以同样的方式翻译了同一个目录下的一些类似的模板,几乎和这个相当。但是这个模板让我很无奈。
如果没有翻译标签{% blocktrans %},它可以正常工作并呈现变量。
c_filter_size.html
{% load i18n %}
{% if ffilter %}
<div class="badge badge-success text-wrap" style="width: 12rem;"">{% trans "Filter sizing check" %}</div>
<h6><small><p class="p-1 mb-2 bg-info text-white">{% trans "The filter sizing is successfully performed." %}
</p></small></h6>
{% if ffilter1 and ffilter.wfsubtype != ffilter1.wfsubtype %}
<div class="badge badge-success text-wrap" style="width: 12rem;"">{% trans "Filter sizing check" %}</div>
<h6><small><p class="p-1 mb-2 bg-info text-white">
If you insist on the fineness, but allow
to reduce flow rate up to {{ffilter1.flowrate}} m3/hr the filter size and therefore filter
price can be reduced.
</p></small></h6>
{% endif %}
带有翻译标签{% blocktrans %} 它既不能用英语也不能用翻译的语言来渲染变量。其他类似的模板也能顺利工作。
c_filter_size.html
{% load i18n %}
{% if ffilter %}
<div class="badge badge-success text-wrap" style="width: 12rem;"">{% trans "Filter sizing check" %}</div>
<h6><small><p class="p-1 mb-2 bg-info text-white">{% trans "The filter sizing is successfully performed." %}
</p></small></h6>
{% if ffilter1 and ffilter.wfsubtype != ffilter1.wfsubtype %}
<div class="badge badge-success text-wrap" style="width: 12rem;"">{% trans "Filter sizing check" %}</div>
<h6><small><p class="p-1 mb-2 bg-info text-white">
{% blocktrans %}
If you insist on the fineness, but allow
to reduce flow rate up to {{ffilter1.flowrate}} m3/hr the filter size and therefore filter
price can be reduced.
{% endblocktrans %}
</p></small></h6>
{% endif %}
django.po
...
#: rsf/templates/rsf/comments/c_filter_size.html:11
#, python-format
msgid ""
"\n"
" If you insist on the fineness, but allow\n"
" to reduce flow rate up to <b>%(ffilter1.flowrate)s</b> m3/hr the "
"filter size and therefore filter\n"
" price can be reduced.\n"
" "
msgstr ""
"\n"
" Если тонкость фильтрации изменить невозможно, но возможно уменьшить "
"расход до <b>%(ffilter1.flowrate)s</b> м3/час, то "
"размер фильтра и соответственно его цена могут быть уменьшены."
...
谢谢
【问题讨论】:
标签: django python-3.x django-templates