【问题标题】:Flask-babel unable to recognize _ or gettextFlask-babel 无法识别 _ 或 gettext
【发布时间】: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


    【解决方案1】:

    啊,即使在 jinja 中,我也需要 ""。 n00b!

    【讨论】:

      猜你喜欢
      • 2016-02-02
      • 2018-03-18
      • 1970-01-01
      • 1970-01-01
      • 2018-03-13
      • 2017-01-04
      • 1970-01-01
      • 2020-04-16
      • 1970-01-01
      相关资源
      最近更新 更多