babel.cfg keywords?
See original GitHub issueI’m finding it hard to locate documentation on how to specify keywords in my babel.cfg. I have a config file that looks like this:
[python: **.py]
encoding = utf-8
[jinja2: **/templates/**.html]
encoding = utf-8
extensions=jinja2.ext.autoescape,jinja2.ext.with_
[javascript: .tmp/**.js]
encoding = utf-8
keywords = translate, ifPlural
All messages are extracted as expected except javascript. I’ve tried just setting one keyword in the config, changing the key from keywords to extract_messages, and keyword but none seem to work. I’ve checked what keywords get passed to babel.messages.extract.extract_javascript (by simply doing sys.exit(keywords) at the start of the function) and they never appear. However, doing pybabel extract -k translate -k ifPlural works just fine.
Issue Analytics
- State:
- Created 10 years ago
- Reactions:5
- Comments:6
Top Results From Across the Web
Command-Line Interface — Babel 2.11.0 documentation
Babel includes a command-line interface for working with message catalogs, ... multiple times) --no-default-keywords do not include the default keywords -F ...
Read more >Babel Documentation - Read the Docs
:param keywords: a list of keywords (i.e. function names) that should ... either be specified on the command-line, or in the setup.cfg file....
Read more >babel/plugin-transform-classes
When extending a native class (e.g., class extends Array {} ), the super class needs to be wrapped. This is needed to workaround...
Read more >Popular "keywords:"babel-config"" JavaScript packages | Skypack
14 results for "keywords:"babel-config"" ... webhint parser to analyze babel config ... A babel config for Trend Micro Frontend.
Read more >keywords:babelrc - npm search
Find the closest babel config based on a directory ... Read the closet Babel configuration file ... Helper for integrating babel config &...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

There still doesn’t seem to be any way to specify keywords in the mapping file 😦 I’m considering duplicating the keywords in my extractor as both an option (specifiable in mapping file, not cli) and keywords (specifiable on cli, not mapping file), but it sounds like this would be very easy to support in Babel.
@scop @akx @mbirtwell Alerting you to this old/weird issue 😃