Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions docs/messages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@ Genshi markup templates and text templates:

.. code-block:: ini

# Extraction from Python source files
# Skip vendored Python files; extract from all other Python files

[ignore: vendor/**.py]
[python: **.py]

# Extraction from Genshi HTML and text templates
Expand All @@ -147,6 +148,13 @@ two subsequent asterisk characters (``**``) can be used to make the wildcard
match any directory level, so the pattern ``**.txt`` matches any file with the
extension ``.txt`` in any directory.

When extracting from a directory, Babel matches each file's path relative to
that directory and uses the first matching method. For example, with
``pybabel extract -F babel.cfg -o messages.pot src``, the path matched for
``src/vendor/example.py`` is ``vendor/example.py``. Put the ``ignore`` mapping
before ``[python: **.py]`` as shown above; otherwise the Python extractor will
process the vendored file too.

Babel supports two configuration file formats: INI and TOML.

INI Configuration Format
Expand Down Expand Up @@ -177,7 +185,11 @@ The same configuration examples shown above can be written in TOML format:

.. code-block:: toml

# Extraction from Python source files
# Skip vendored Python files; extract from all other Python files
[[mappings]]
method = "ignore"
pattern = "vendor/**.py"

[[mappings]]
method = "python"
pattern = "**.py"
Expand Down