【发布时间】:2015-10-19 21:54:23
【问题描述】:
我的模板中有以下内容:
<a class="page-scroll" href="#career">{{ _(Career) }}</a>
<a class="page-scroll" href="{{ url_for("comment_new") }}">{{ gettext(Contact) }}</a>
<a href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">{% trans %}Language{% endtrans %}</a>
当我运行pybabel extract -F babel.cfg -o messages.pot .
我只看到:
#: templates/hello.html:91
msgid "Language"
msgstr ""
但不是“职业”或“语言”。我不明白为什么 babel 没有在 jinja 中解释 _ 或 gettext。帮助?
【问题讨论】:
标签: python flask python-babel flask-babel