From 9c19db429f861f51322aef8b2d41158ae4596ba0 Mon Sep 17 00:00:00 2001 From: Paul Wilde Date: Tue, 10 May 2022 22:27:54 +0100 Subject: [PATCH] added translate --- translate.nim | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/translate.nim b/translate.nim index a129878..b2c3474 100644 --- a/translate.nim +++ b/translate.nim @@ -1,9 +1,12 @@ import base import std/[re,httpclient,json,strutils] + +# TODO: Add language detection and translate into HOME language + const LIBRETRANSLATE_URL = "https://libretranslate.pussthecat.org/translate" -const PRIMARY = "en" -const SECONDARY = "de" +const HOME = "en" +const FIRST_CHOICE = "de" let LANG_RE = re"\w+>\w+" type @@ -16,8 +19,8 @@ type proc main(message: varargs[string] = @[]) proc newRequest(): Request = - return Request(source:SECONDARY, - target:PRIMARY, + return Request(source:FIRST_CHOICE, + target:HOME, q: "", format: "text",)