added translate

This commit is contained in:
Paul Wilde 2022-05-10 22:34:47 +01:00
parent 9c19db429f
commit f9bde50717

View file

@ -3,6 +3,7 @@ import std/[re,httpclient,json,strutils]
# TODO: Add language detection and translate into HOME language
# Once one translation is done, stay in that translation until told otherwise
const LIBRETRANSLATE_URL = "https://libretranslate.pussthecat.org/translate"
const HOME = "en"
@ -64,13 +65,17 @@ proc main(message:varargs[string] = @[]) =
var info = newInfo("Translate")
info.selected_bg = green
var args: seq[string] = @[]
for msg in message:
if msg != "":
args.add(msg)
if len(message) > 0:
for msg in message:
if msg != "":
args.add(msg)
args.add("back")
args.add("exit")
let output = outputData(info,args)
if output == "exit" or output == "":
return
elif output == "back":
main()
elif output in message:
copyToClipboard(output)
else: