inveniosoftware / troubleshooting

DEPRECATED - Use the forum instead:
https://invenio-talk.web.cern.ch
5 stars 4 forks source link

Some strings are not extracted for translations #31

Open jma opened 6 years ago

jma commented 6 years ago

Problem

In jinja templates containing assets block, the strings marked for translation i.e. {{_('to_translate')}} are not extracted by the python setup.up extract_messages command. No error message is displayed.

Solution

A new filter webassets.ext.jinja2.AssetsExtension should be added in the babel.ini file. For example:

[jinja2: **/templates/**.html]
encoding = utf-8
extensions = jinja2.ext.autoescape, jinja2.ext.with_, webassets.ext.jinja2.AssetsExtension