Overview Description
We are using PyBabel for i18n in our software and Jinja2 extension for HTML files. However, files which are located in directories starting with an underscore, e.g. _partials, are not extracted into the .pot file, even if the rest of directories are taken into account.
It happens both with .py files and in .html files (using Jinja2)
This is our Babel config file:
[python: liberaforms/models/**.py]
[python: liberaforms/utils/**.py]
[python: liberaforms/views/**.py]
[jinja2: liberaforms/templates/**.html]
[jinja2: liberaforms/templates/**.js]
[jinja2: assets/inline_help/menu.json]
[jinja2: assets/inline_help/pages/**]
extensions=jinja2.ext.loopcontrols
I also tried pointing to the exact file by including the whole path into the Babel config file.
Is the character _ excluded from **?
Steps to Reproduce
- Create a directory starting with an underscore, e.g.
_test
- Reference the directory in your Babel config file
- Run
pybabel extract command
- Check your updated .pot file: the i18n-ed strings in those directories won't be in the .pot
Actual Results
The files under directories starting with underscore are not included into .pot
If you change the directory name to start with hyphen (-), the file is included.
No matter whether strings are i18n-ed as _("string") or as gettext("string")
Expected Results
If using ** in the Babel config should include all directories (as documentation points out), also directories starting with underscore should be included.
Additional Information
Our code repo: https://gitlab.com/liberaforms/liberaforms/-/tree/develop
Our babel config file: https://gitlab.com/liberaforms/liberaforms/-/blob/develop/babel/messages.cfg
A real example of directory starting with underscore: https://gitlab.com/liberaforms/liberaforms/-/tree/develop/liberaforms/templates/form/_partials
Overview Description
We are using PyBabel for i18n in our software and Jinja2 extension for HTML files. However, files which are located in directories starting with an underscore, e.g.
_partials, are not extracted into the .pot file, even if the rest of directories are taken into account.It happens both with .py files and in .html files (using Jinja2)
This is our Babel config file:
I also tried pointing to the exact file by including the whole path into the Babel config file.
Is the character
_excluded from**?Steps to Reproduce
_testpybabel extractcommandActual Results
The files under directories starting with underscore are not included into .pot
If you change the directory name to start with hyphen (
-), the file is included.No matter whether strings are i18n-ed as
_("string")or asgettext("string")Expected Results
If using
**in the Babel config should include all directories (as documentation points out), also directories starting with underscore should be included.Additional Information
Our code repo: https://gitlab.com/liberaforms/liberaforms/-/tree/develop
Our babel config file: https://gitlab.com/liberaforms/liberaforms/-/blob/develop/babel/messages.cfg
A real example of directory starting with underscore: https://gitlab.com/liberaforms/liberaforms/-/tree/develop/liberaforms/templates/form/_partials