【发布时间】:2017-05-02 16:46:38
【问题描述】:
我在 Heroku 上部署了我的 Django 应用程序,并添加了 https://github.com/piotras/heroku-buildpack-gettext.git 这个 ugettext buildpack 并且应用程序的某些部分已翻译注释。在本地它正在工作,我不知道问题来自哪里。
例如,菜单项Classes Types不翻译,但其他部分翻译。
{% trans "Class Types" %}
模板
{% 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 "انواع الحلقات"
zh/LC_MESSAGES.po
#: templates/back_office/class_type_list.html:4
#: templates/back_office/menu.html:37
msgid "Class Types"
msgstr "Class Types"
【问题讨论】:
标签: python django heroku gettext