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
|
# 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 LIBRETRANSLATE_URL = "https://libretranslate.pussthecat.org/translate"
|
||||||
const HOME = "en"
|
const HOME = "en"
|
||||||
|
@ -64,13 +65,17 @@ proc main(message:varargs[string] = @[]) =
|
||||||
var info = newInfo("Translate")
|
var info = newInfo("Translate")
|
||||||
info.selected_bg = green
|
info.selected_bg = green
|
||||||
var args: seq[string] = @[]
|
var args: seq[string] = @[]
|
||||||
|
if len(message) > 0:
|
||||||
for msg in message:
|
for msg in message:
|
||||||
if msg != "":
|
if msg != "":
|
||||||
args.add(msg)
|
args.add(msg)
|
||||||
|
args.add("back")
|
||||||
args.add("exit")
|
args.add("exit")
|
||||||
let output = outputData(info,args)
|
let output = outputData(info,args)
|
||||||
if output == "exit" or output == "":
|
if output == "exit" or output == "":
|
||||||
return
|
return
|
||||||
|
elif output == "back":
|
||||||
|
main()
|
||||||
elif output in message:
|
elif output in message:
|
||||||
copyToClipboard(output)
|
copyToClipboard(output)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue