UNPKG

auto-translatr

Version:
13 lines (12 loc) 551 B
"use strict"; 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}`;