translate-text
by Arnon
Translate Text
// Menu: Translate// Description: Translate Text// Author: Arnon Eilatlet { getSelectedText } = await kit("text");const getWord = async () => {let word = await arg("Word to Translate");if (word === "") {word = await getSelectedText();}return encodeURIComponent(word.trim());};const open = (url) => exec(`open "${url}"`);onTab("Google Translate ", async () => {const word = await getWord();const url = `https://translate.google.com/#view=home&op=translate&sl=en&tl=iw&text=${word}`;open(url);});onTab("Yandex Translate", async () => {const word = await getWord();const url = `https://translate.yandex.com/?lang=en-he&text=${word}`;open(url);});