Babel plugin to extract gettext strings from JavaScript/JSX code, supporting ES6+ and JSX syntax. Current stable version is 4.1.3, maintained by Sentry. It is a fork of babel-gettext-plugin with added support for references and earlier Node.js versions. Works with Babel 7. Key differentiators: flexible configuration of function names, custom output file naming via a callback, base directory for relative paths, and optional whitespace stripping from template literals. Alternatives like babel-plugin-react-intl focus on React Intl, while this plugin targets the standard gettext workflow.
npm install babel-gettext-extractorVerified import paths — ran on the pinned version, not inferred.
Configures babel-gettext-extractor with custom function names and headers, outputs a .pot file.
Replace 'babel-gettext-plugin' with 'babel-gettext-extractor' in your Babel config.
Replace require('babel') with require('@babel/core') and update config accordingly.Return false from the fileName function to prevent output for that file.
Ensure your gettext runtime also strips leading indent when using this option.
Use fileName function or Babel's ignore/include patterns to control which files are processed.
Run 'npm install --save-dev babel-gettext-extractor' and verify the plugin string is correct.
Check the option names: valid ones are 'headers', 'functionNames', 'fileName', 'baseDirectory', 'stripTemplateLiteralIndent'.
Ensure you are using Babel 7 and pass the file object correctly; check the example in the README.
Ensure your source files contain calls to configured functionNames with string literals. Check console logs for skipped files. Confirm fileName path is absolute or relative to the working directory.
No dependency data recorded yet.