/** * String Collector - Manages translation content across two-pass transformation * * Pass 1: Collects translation strings, JSX content, and hash data * Pass 2: Injects collected data back into useGT()/getGT() calls */ /** * Content extracted from a t() function call */ export interface TranslationContent { /** The string message: t("Hello world") → "Hello world" */ message: string; /** Pre-calculated hash for this content */ hash: string; /** Optional ID from options: t("text", {$id: "greeting"}) → "greeting" */ id?: string; /** Optional context from options: t("text", {$context: "nav"}) → "nav" */ context?: string; /** Optional maxChars from options: t("text", {$maxChars: 10}) → 10 */ maxChars?: number; /** Optional format from options: t("text", {$format: "STRING"}) → "STRING" */ format?: string; /** Optional requiresReview from options: t("text", {$requiresReview: true}) → true */ requiresReview?: boolean; } /** * Content extracted from JSX translation components like */ export interface TranslationJsx { /** Pre-calculated hash for this JSX content */ hash: string; /** JSX children structure (serializable) */ children?: unknown; /** Optional ID from props */ id?: string; /** Optional context from props */ context?: string; /** Optional requiresReview from props */ requiresReview?: boolean; } /** * Just a hash value for simple hash injection */ export interface TranslationHash { /** The hash value to inject */ hash: string; } type SerializedStringCollector = { contentAggregators: Record; jsxAggregators: Record; hashAggregators: Record; globalCallCounter: number; }; /** * String collector for two-pass transformation system */ export declare class StringCollector { /** Vector of translation calls indexed by counter ID */ private contentAggregators; private jsxAggregators; private hashAggregators; /** Global counter incremented for each useGT/getGT call encountered */ private globalCallCounter; /** Runtime-only entries for standalone strings consumed by runtime translate */ private runtimeOnlyEntries; /** * Increment counter and return the current counter ID for a useGT/getGT call * These IDs are deterministic */ incrementCounter(): number; /** * Get current global counter value */ getCounter(): number; /** * Pass 1: Add translation content from a gt() call to a specific useGT/getGT aggregator * Multiple content items can be added to the same call */ pushTranslationContent(counterId: number, content: TranslationContent): void; /** * Pass 1: Set JSX translation content for a specific useGT/getGT * Only one JSX item can be set per call (overwrites if called multiple times) */ setTranslationJsx(counterId: number, jsx: TranslationJsx): void; /** * Pass 1: Set hash-only content for a specific useGT/getGT * Only one hash can be set per call (overwrites if called multiple times) */ setTranslationHash(counterId: number, hash: TranslationHash): void; /** * Pass 2: Get translation call data for injection into a specific useGT/getGT call */ getTranslationData(counterId: number): { type: 'content' | 'jsx' | 'hash'; value: TranslationContent[] | TranslationJsx | TranslationHash; } | undefined; /** * Get the translation content for a specific useGT/getGT call */ getTranslationContent(counterId: number): TranslationContent[] | undefined; /** * Get the translation JSX for a specific component */ getTranslationJsx(counterId: number): TranslationJsx | undefined; /** * Get the translation hash for a specific other call */ getTranslationHash(counterId: number): TranslationHash | undefined; /** * Reset all state (useful for testing) */ clear(): void; /** * Reset the counter to zero */ resetCounter(): void; /** * Has content */ hasContent(): boolean; /** * Get all translation content entries (flattened across all aggregators) */ getAllTranslationContent(): TranslationContent[]; /** * Get all translation JSX entries */ getAllTranslationJsx(): TranslationJsx[]; /** * Add a runtime-only translation entry for the runtime translate pass. */ pushRuntimeOnlyContent(content: TranslationContent): void; /** * Get all runtime-only translation entries */ getRuntimeOnlyContent(): TranslationContent[]; /** * Helper convert to string */ serialize(): SerializedStringCollector; /** * Helper to repopulate */ unserialize(input: SerializedStringCollector): void; } export {}; //# sourceMappingURL=StringCollector.d.ts.map