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.
19 lines • 869 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.runAcrossShards = runAcrossShards;
const sharding_1 = require("./sharding");
/**
* Share the "build shards, assign a pool triple, run in parallel"
* scaffold that both pipelines need. The pipeline supplies only the
* per-shard body via `work`.
*
* Groups stay whole within a shard so each worker's chat history
* accumulates related items. `concurrency` is implicit in `pool.size`.
*/
async function runAcrossShards(flatInput, groups, pool, work) {
const groupShards = (0, sharding_1.buildGroupShards)(groups, pool.size);
const shards = groupShards.length > 0 ? groupShards : [flatInput];
const triples = pool.all();
return Promise.all(shards.map((shard, shardIdx) => work(shard, triples[shardIdx % triples.length])));
}
//# sourceMappingURL=shard_runner.js.map