Usage
path, extract scans the current directory.
Behavior
extract scans .ts and .tsx files for React Intl message descriptors in defineMessage, defineMessages, intl.formatMessage, and <FormattedMessage />.
It writes a FormatJS-style JSON catalog to stdout by default. Each key is the message id. Each value includes defaultMessage and, when present, description.
id, extract generates a FormatJS-compatible id from defaultMessage and description.
extract skips .d.ts files and common generated directories such as .git, .next, build, coverage, dist, and node_modules.
Flags
--flatten: hoist ICU plural and select branches so each branch contains a full sentence.--ignore <glob>: exclude files that match a glob pattern. You can pass this flag more than once.--out-file <path>: write the extracted catalog to a JSON file instead of stdout.--prefix-id: prefix message ids with the normalized source filename. Usepack --prefix-idto strip these prefixes later.