问题
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:
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.
来源:https://stackoverflow.com/questions/25249963/pyramid-chameleon-i18n-not-finding-template-files