You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 commentedon Jun 13, 2025
I looked at the source code and realized that at the core of the traversal is function
extract_from_dirwhich usesos.walkto traverse the directory.os.walkby default does not traverse symlinks. But it has a parameterfollowlinksthat can be used to instruct it to follow them.Since I needed this feature I went ahead and added an optional
follow-linksparameter inextract_from_dirandfrontend. Now passingfollow_links=Trueor--follow-linksrespectively 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