我在 Heroku 上部署了 Django 应用程序,并添加了https://github.com/piotras/heroku-buildpack-gettext.git
此 ugettext 构建包和应用程序的某些部分已注释翻译。本地可以用,不知道问题出在哪里。
例如,菜单项课程类型没有翻译,但其他部分是。
{% trans "Class Types" %}
template
{% load i18n %}
....
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{% trans "Class Types" %}<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
<a href="{% url 'class_type-list' %}">
<span class="glyphicon glyphicon-list" aria-hidden="true"></span> {% trans "All" %}</a>
</li>
<li>
<a href="{% url 'class_type-new' %}">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> {% trans "New" %}</a>
</li>
</ul>
</li>
....
ar/LC_MESSAGES.po
#: templates/back_office/class_type_list.html:4
#: templates/back_office/menu.html:37
msgid "Class Types"
msgstr "انواع الحلقات"
en/LC_MESSAGES.po
#: templates/back_office/class_type_list.html:4
#: templates/back_office/menu.html:37
msgid "Class Types"
msgstr "Class Types"
经过一番研究,我发现最好提交编译后的消息文件(*.mo) 到 Heroku,翻译将正常工作。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)