From c66a519751d5e01c3b948bb1dd34e19457f3ae71 Mon Sep 17 00:00:00 2001 From: dingedi Date: Fri, 23 Sep 2022 14:20:22 +0200 Subject: [PATCH] restore formatting only if transliteration dont fail --- app/language.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/language.py b/app/language.py index 6cee0cd..2e2e65f 100644 --- a/app/language.py +++ b/app/language.py @@ -129,12 +129,12 @@ def __transliterate_line(transliterator, line_text): # the actual transliteration of the word t_word = transliterator.transliterate(orig_word.strip(string.punctuation)) - t_word = improve_translation_formatting(orig_word.strip(string.punctuation), t_word, improve_punctuation=False) - # if transliteration fails, default back to the original word if not t_word: t_word = orig_word else: + t_word = improve_translation_formatting(orig_word.strip(string.punctuation), t_word, improve_punctuation=False) + # add back any stripped punctuation if r_diff: t_word = t_word + "".join(r_diff)