i18n-ai-translate
Version:
AI-powered localization CLI, Node library, and GitHub Action. Translate i18next JSON, Gettext PO, Java .properties, and iOS .strings with ChatGPT, Claude, Gemini, or local Ollama models.
16 lines (15 loc) • 752 B
TypeScript
/**
* Run a list of async tasks with bounded concurrency.
*
* Unlike Promise.all(list.map(...)) this never schedules more than
* `limit` tasks in flight at once — useful for fanning out over many
* target languages without each one spinning up its own chat pool
* before the first language has finished.
*
* When `limit` is 1 the behaviour collapses to serial execution,
* matching the current default so existing workflows don't change.
*
* Errors are surfaced via Promise.allSettled semantics: every task
* runs to completion, and the returned array preserves input order.
*/
export declare function runWithConcurrency<T, R>(items: T[], limit: number, task: (item: T, index: number) => Promise<R>): Promise<PromiseSettledResult<R>[]>;