Pyramid Chameleon I18N not finding template files

2019-09-09 16:56发布

I'm following this recipe, with a small test project called i18n

Chameleon I18N

I've set up the message_extractors as follows:

message_extractors = { '.': [
    ( '**.py', 'lingua_python', None ),
    ( '**.pt', 'lingua_xml', None ),
    ]};

When I run the extract_messages code, I don't get any templates processed:

../bin/python setup.py extract_messages -o locale/test.pot
    running extract_messages
    extracting messages from i18n/__init__.py
    extracting messages from i18n/models.py
    extracting messages from i18n/tests.py
    extracting messages from i18n/views.py
    extracting messages from i18n/scripts/__init__.py
    extracting messages from i18n/scripts/initializedb.py
    writing PO template file to locale/test.pot

Why are the template files skipped when they're in the source tree?

1条回答
ゆ 、 Hurt°
2楼-- · 2019-09-09 17:20

That section of the cookbook is outdated: current versions of lingua no longer use Babel, or any configuration through setup.py/setup.cfg. You can use lingua's pot-create command to extract messages from your code and mpaltes instead. The lingua page on PyPI has a fair amount of documentation and examples for doing that.

查看更多
登录 后发表回答