diff --git a/translate.nim b/translate.nim index b2c3474..1102c9e 100644 --- a/translate.nim +++ b/translate.nim @@ -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: