Extracting Javascript gettext messages using Babel CLI extractor

Create a file (babel.cfg) with the following content:

[javascript:*.js]
encoding = utf-8

Then, do:

pybabel extract -F babel.cfg /path/to/js-dir

That should be enough for you to have some message strings.

BTW, you can consult the help for the extract command by doing:

pybabel extract --help

I had a similar issue and was able to get around it by disabling default keywords with babel.

pybabel extract -k __ -F babel.cfg --no-default-keywords /path/to/js-dir 

You must specify at least one keyword in the command when you disable the defaults (-k [keyword]). I chose -k __ because "__" was a pattern I was looking for.

Just use this command and replace the "__" after -k with one from your babel.cfg file.

Edit: this allows you to use your own keywords rather than gettext()