/** * What a caller of translateJSON is owed. * * `content` is a map of caller-owned keys to source strings. The keys are the * contract: they are how a translation finds its way back to the place in the * document the text came from. Values are plain text, never markup. * * `isFlat` describes the shape of `content`, not a preference: * - true — every value is a string at the top level (Storyblok passes this); * - false — values may be nested objects, and the returned structure mirrors * the input one for one (Sanity passes this). * * `notTranslatableWords` are terms that must survive translation byte for byte — * product and brand names. Order of the list carries no meaning. * * `currentLanguage` absent means the source language is left for the model to * detect. `targetLanguage` is a human-readable language name, not a code. * * Returns a JSON string of the same shape as `content`, with values translated. * * Guarantees: * - one request to the model per call, whatever the number of keys; * - an empty `content` costs nothing: the model is not called at all and the * result is an empty JSON object; * - every key the model answered for carries that answer and no other key's; * - keys the model omitted are absent from the result rather than empty — the * caller keeps the source text for them; * - keys the model invented are discarded; * - a value the model answered with that is not a string counts as no answer; * - leading and trailing whitespace of a source value survives translation: * models routinely drop it, and callers splice these values back into a * sentence where the space is what keeps two words apart; * - a reply that cannot be read as JSON rejects with an Error reading * "Failed to translate JSON"; transport and configuration failures surface as * themselves, so callers can tell a bad answer from an unreachable provider. * * Nothing is guaranteed about the order of keys in the returned JSON. */ export type TranslateJSON = (options: TranslateOptions) => Promise; interface TranslateOptions { targetLanguage: string; currentLanguage?: string; content: object; promptModifier?: string; isFlat?: boolean; notTranslatableWords: string[]; } export declare const translateJSON: TranslateJSON; export {};