added translate
This commit is contained in:
parent
9c19db429f
commit
f9bde50717
1 changed files with 8 additions and 3 deletions
|
@ -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] = @[]
|
||||
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:
|
||||
|
|
Loading…
Reference in a new issue