~metalune/simplytranslate-devel

web: Add ICIBA as a translation engine v1 SUPERSEDED

: 1
 Add ICIBA as a translation engine

 3 files changed, 10 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~metalune/simplytranslate-devel/patches/25751/mbox | git am -3
Learn more about email & git

[PATCH web] Add ICIBA as a translation engine Export this patch

From: Austin Huang <austinhuang@disroot.org>

---
 config.conf          | 4 ++++
 main.py              | 4 ++++
 templates/index.html | 2 ++
 3 files changed, 10 insertions(+)

diff --git a/config.conf b/config.conf
index 237d8fd..3f2cac2 100644
--- a/config.conf
+++ b/config.conf
@@ -14,3 +14,7 @@ ApiKey = [REDACTED]
[google]
# Google translate is enabled by default.
Enabled = True

[iciba]
# ICIBA Translate (a.k.a. PowerWord) is disabled by default.
Enabled = False
diff --git a/main.py b/main.py
index 03d3235..9b6f069 100644
--- a/main.py
+++ b/main.py
@@ -14,6 +14,7 @@ from io import BytesIO

from simplytranslate_engines.googletranslate import GoogleTranslateEngine
from simplytranslate_engines.libretranslate import LibreTranslateEngine
from simplytranslate_engines.icibatranslate import IcibaTranslateEngine
from simplytranslate_engines.utils import *

import requests
@@ -43,6 +44,9 @@ if libretranslate_enabled:
        )
    )

if config.getboolean("iciba", "Enabled", fallback=False):
    engines.append(IcibaTranslateEngine())

if not engines:
    raise Exception("All translation engines are disabled")

diff --git a/templates/index.html b/templates/index.html
index 2d173b4..cd7ad90 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -149,6 +149,8 @@
                                Google
                            {%- elif _engine == "libre" -%}
                                LibreTranslate
                            {%- elif _engine == "iciba" -%}
                                ICIBA
                            {%- else -%}
                                {{ _engine }}
                            {%- endif -%}
-- 
2.33.0
This patch doesn't apply with the current version of the
simplytranslate_web repository, please fix (it's probably just something
to do with the fact that I added some lines in the config.conf to add
deepl support)