Open mauritsvanrees opened 4 years ago
I just noticed that since Python 3.5, **
is supported by glob
. Trying it out:
$ ls **/*.po
ls: **/*.po: No such file or directory
$ python -i **/*.po
python: can't open file '.../plone/app/locales/**/*.po': [Errno 2] No such file or directory
>>> import glob
>>> import sys
>>> sys.argv
['**/*.po']
>>> glob.glob(sys.argv[0])
[]
>>> glob.glob(sys.argv[0], recursive=True)
['locales/sl/LC_MESSAGES/widgets.po', ... 'locales-addons/es/LC_MESSAGES/plone.app.ldap.po']
>>> len(glob.glob(sys.argv[0], recursive=True))
472
That would mean that you could write the command like this, if we start supporting it:
i18ndude sync --pot locales/plone.pot **/plone.po
This command works, because the shell automatically expands the star before passing it to i18ndude:
The same command in tox fails, because tox does not do expansion:
When I replace the star with
nl
thetox
command works fine for the Dutch locale.See https://stackoverflow.com/a/62113401/621201, also for basic
glob
code example.