import type { MessagesFormat } from './format/types.js'; export type Locale = string; export type ExtractorMessageReference = { path: string; line?: number; }; /** A single statically extracted source-code usage before any aggregation. */ export type SourceMessage = { id: string; message: string; description: string | null; reference: ExtractorMessageReference; }; /** An aggregated message that can be read from or written to a catalog. */ export type ExtractorMessage = { id: string; message: string; /** * All unique descriptions attached to messages (e.g. multiple `#.` lines in PO). * Ordered by source reference (path, then line). */ description: Array; /** * Source locations for this message (e.g. `#:` lines in PO). Ordered by path, then line. * Empty when the catalog format does not store references or none are known. */ references: Array; /** Allows for additional properties like .po flags to be read and later written. */ [key: string]: unknown; }; /** * External extractor configuration (Next.js plugin, `extractMessages`). */ export type ExtractorConfigInput = { /** * Relative path(s) to your source code files. */ srcPath?: string | Array; messages: { /** The format of your messages files. */ format: MessagesFormat; /** Relative path(s) to your messages files. */ path: string | Array; /** * Locales kept in sync with [`messages.sourceLocale`](https://next-intl.dev/docs/usage/plugin#messages-source-locale). */ locales: 'infer' | ReadonlyArray; /** Locale to which extracted source strings are written. */ sourceLocale?: string; }; /** * Enables the usage of `useExtracted`. */ extract?: true | { /** Defaults to `messages.path` when it is a single path. */ path?: string; /** @deprecated Prefer `messages.sourceLocale`. */ sourceLocale?: string; }; }; /** Normalized config used internally after `normalizeExtractorConfig`. */ export type ExtractorConfig = { extract: { locales: 'infer' | ReadonlyArray; path: string; sourceLocale: string; srcPath: string | Array; }; messages: { format: MessagesFormat; path: Array; }; }; export type CatalogLoaderConfig = { messages: { format: MessagesFormat; precompile?: boolean; }; };