From 5773adaabd6c45e843bc603b309cfcbffcf4c7a9 Mon Sep 17 00:00:00 2001
From: Dingedi <64697405+dingedi@users.noreply.github.com>
Date: Tue, 3 May 2022 16:43:05 +0200
Subject: [PATCH] Revert "improve translation formating"

---
 app/app.py | 21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)

diff --git a/app/app.py b/app/app.py
index f3eccfc..8b14615 100644
--- a/app/app.py
+++ b/app/app.py
@@ -474,21 +474,6 @@ def create_app(args):
         if text_format not in ["text", "html"]:
             abort(400, description="%s format is not supported" % text_format)
 
-        def improve_translation(source, translation):
-            if source.islower():
-                return translation.lower()
-
-            if source.isupper():
-                return translation.upper()
-
-            if source[0].islower():
-                return translation[0].lower() + translation[1:]
-
-            if source[0].isupper():
-                return translation[0].upper() + translation[1:]
-
-            return translation
-
         try:
             if batch:
                 results = []
@@ -498,8 +483,7 @@ def create_app(args):
                     if text_format == "html":
                         translated_text = str(translate_html(translator, text))
                     else:
-                        translated_text = improve_translation(text, translator.translate(
-                            transliterate(text, target_lang=source_langs[idx]["language"])))
+                        translated_text = translator.translate(transliterate(text, target_lang=source_langs[idx]["language"]))
 
                     results.append(unescape(translated_text))
                 if source_lang == "auto":
@@ -521,8 +505,7 @@ def create_app(args):
                 if text_format == "html":
                     translated_text = str(translate_html(translator, q))
                 else:
-                    translated_text = improve_translation(q, translator.translate(
-                        transliterate(q, target_lang=source_langs[0]["language"])))
+                    translated_text = translator.translate(transliterate(q, target_lang=source_langs[0]["language"]))
 
                 if source_lang == "auto":
                     return jsonify(
-- 
GitLab