I looked at the source code and realized that at the core of the traversal is function extract_from_dir which uses os.walk to traverse the directory. os.walk by default does not traverse symlinks. But it has a parameter followlinks that can be used to instruct it to follow them.
Since I needed this feature I went ahead and added an optional follow-links parameter in extract_from_dir and frontend. Now passing follow_links=True or --follow-links respectively one is able to tell babel to instruct os.walk to follow symbolic links. If no parameter is passed babel defaults to not follow links, just as before so this new feature should not impact any existing code or workflows.
I made a PR with the new feature #1212 , including documentation and a unit test.
Activity
jmoraleda commented on Jun 13, 2025
I looked at the source code and realized that at the core of the traversal is function extract_from_dir which uses os.walk to traverse the directory. os.walk by default does not traverse symlinks. But it has a parameter followlinks that can be used to instruct it to follow them.
Since I needed this feature I went ahead and added an optional follow-links parameter in extract_from_dir and frontend. Now passing follow_links=True or --follow-links respectively one is able to tell babel to instruct os.walk to follow symbolic links. If no parameter is passed babel defaults to not follow links, just as before so this new feature should not impact any existing code or workflows.
I made a PR with the new feature #1212 , including documentation and a unit test.
Add option to follow symbolic links when extracting from a directory