Open deepl in Script Kit

// Name: DeepL
// Author: Jacob Cofman
// Twitter: @jcofman
// Description: Translates text using https://www.deepl.com/translator
import "@johnlindquist/kit"
let DEEPL_AUTH_KEY = await env("DEEPL_AUTH_KEY", {
hint: md(
`Get a [DeepL API Key](https://www.deepl.com/docs-api/accessing-the-api/)`
),
ignoreBlur: true,
secret: true,
})
let text = await getSelectedText();
let targetLanguage = await arg("Select a traget Language e.g: DE or EN")
let response = await post(
`https://api-free.deepl.com/v2/translate?auth_key=${DEEPL_AUTH_KEY}&text=${text}&target_lang=${targetLanguage}`
)
setSelectedText(response.data.translations[0].text)