4

I have a Pyramid project that uses Jinja2. I am trying to use Babel by adding the following to the setup.py

message_extractors = { '.': [
            ('**.py', 'python', None ),
            ('static/**', 'ignore', None),
            ('resources/**', 'ignore', None),
            ('climmob3/templates/**.html', 'jinja2', None),
            ('FlatLab/**', 'ignore', None),
            ]},

And I have a setup.cfg file with

[compile_catalog]
directory = climmob3/locale
domain = climmob3
statistics = true

[extract_messages]
add_comments = TRANSLATORS:
output_file = climmob3/locale/climmob3.pot
width = 80

[init_catalog]
domain = climmob3
input_file = climmob3/locale/climmob3.pot
output_dir = climmob3/locale

[update_catalog]
domain = climmob3
input_file = climmob3/locale/climmob3.pot
output_dir = climmob3/locale
previous = true

However when I run

python setup.py extract_messages

I can see tha it tries to extract the messages from the template files (.html) but it does not recognizes neither _ or {% trans %} so the .pot file is empty

Do I need to do anything extra?

desertnaut
  • 57,590
  • 26
  • 140
  • 166
QLands
  • 2,424
  • 5
  • 30
  • 50

1 Answers1

0

Since the output is verboese by default you should see any .html files that it passed through and recognized. If none then the paths set in message_extractors are not matching the structure. The python setup.py extract_messages command is relative so climmob3/templates/**.html for example should be in the same folder you run the command.

lalilulelo
  • 85
  • 3
  • 9