Skip to main content

Documentation Index

Fetch the complete documentation index at: https://hyperlocalise.dev/llms.txt

Use this file to discover all available pages before exploring further.

Usage

hyperlocalise extract [path...] [flags]
If you omit 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.
{
  "app.header.title": {
    "defaultMessage": "Dashboard",
    "description": "Main dashboard heading"
  }
}
If a descriptor has no 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. Use pack --prefix-id to strip these prefixes later.

Examples

hyperlocalise extract src --out-file lang/en.json
hyperlocalise extract "src/**/*.{ts,tsx}" --ignore "**/*.test.{ts,tsx}" --flatten