restore formatting only if transliteration dont fail

This commit is contained in:
dingedi 2022-09-23 14:20:22 +02:00
parent 077d6e9efa
commit c66a519751
No known key found for this signature in database
GPG key ID: EE23A12D271A3CED

View file

@ -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)