// Name: Auto Translate & Define
// Description: Auto-detect language, translate, and provide dictionary definition with a keystroke
// Author: dor-zarzilla
// GitHub: dor-zarzilla
import "@johnlindquist/kit"
// Get selected text from the active application
const selectedText = await getSelectedText()
if (!selectedText || selectedText.trim() === '') {
await div(md('# No Text Selected\n\nPlease select some text first, then run this script.'))
exit()
}
const text = selectedText.trim()
// Set up loading state
setStatus({ message: "Detecting language and translating...", status: "busy" })