I have an App Engine app running python with jinja2 html templates. I am using pybabel to internationalize it. When i run the command pybabel extract -F babel.cfg -o ./locale/messages.pot ./
to extract from the templates, it adds extra single quotes ' to the strings with single quotes and escapes doubles quotes on the keywords that use double quotes.
Example: I am extracting these strings:
index.html
<h1 class="offset2 span10 pageTitle">{{ _("appname") }}</h1>
<p>{{ _('about') }}</p>
turns into
messages.pot
#: templates/index.html:57
msgid "\"appname\""
msgstr ""
#: templates/index.html:58
msgid "'about'"
msgstr ""
Which do not work. Expected (and confirmed working if i remove unwanted characters manually) output should be:
messages.pot
#: templates/index.html:57
msgid "appname"
msgstr ""
#: templates/index.html:58
msgid "about"
msgstr ""
in messages.pot after pybabel extract is run.
Of course this does not work when i update and compile and run the app, but if i remove the extra added single quotes and escaped quotes, it works as intended. If you don't use quotes on the keywords in the template file, it does not work.
The babel.cfg file is pretty simple:
[django: templates/**.*]
[python: /**.py]
encoding = utf-8
[extractors]
jinja2 = jinja2.ext:babel_extract
Any suggestions on how to make pybabel extract not include extra quotes when it extracts keywords from templates? Or any other method of extracting from the files?
Problem was in the babel.cfg file. Change it from
to