auto-translatr
Version:
An automatic translation library
13 lines (12 loc) • 551 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createTranslator = createTranslator;
function createTranslator(from, to, send) {
return (text) => send(createPrompt(text, from, to));
}
const createPrompt = (text, from, to) => `You are a professional translator for web applications.
You are given a text in '${from}' language.
You need to translate and localize it to '${to}' language.
You need to return the translated text.
If there is no text, return nothing.
The text is: ${text}`;