[PATCH web v2] 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 504291c..93c911f 100644
--- a/config.conf
+++ b/config.conf
@@ -18,6 +18,10 @@ Enabled = True
[deepl]
Enabled = True
+[iciba]
+# ICIBA Translate (a.k.a. PowerWord) is disabled by default.
+Enabled = False
+
[network]
port = 5000
host = 0.0.0.0
diff --git a/main.py b/main.py
index 7643e84..c50cce5 100644
--- a/main.py
+++ b/main.py
@@ -15,6 +15,7 @@ from io import BytesIO
from simplytranslate_engines.googletranslate import GoogleTranslateEngine
from simplytranslate_engines.libretranslate import LibreTranslateEngine
from simplytranslate_engines.deepl import DeeplEngine
+from simplytranslate_engines.icibatranslate import IcibaTranslateEngine
from simplytranslate_engines.utils import *
import requests
@@ -31,6 +32,9 @@ if config.getboolean("google", "Enabled", fallback=True):
if config.getboolean("deepl", "Enabled", fallback=False):
engines.append(DeeplEngine())
+if config.getboolean("iciba", "Enabled", fallback=False):
+ engines.append(IcibaTranslateEngine())
+
libretranslate_enabled = config.getboolean("libre", "Enabled", fallback=None)
if libretranslate_enabled is None:
diff --git a/templates/index.html b/templates/index.html
index cf8e6cc..c5feb9b 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -151,6 +151,8 @@
DeepL (Testing)
{%- elif _engine == "libre" -%}
LibreTranslate
+ {%- elif _engine == "iciba" -%}
+ ICIBA
{%- else -%}
{{ _engine }}
{%- endif -%}
--
2.33.0