mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-11-25 01:11:00 +00:00
restore formatting only if transliteration dont fail
This commit is contained in:
parent
077d6e9efa
commit
c66a519751
1 changed files with 2 additions and 2 deletions
|
@ -129,12 +129,12 @@ def __transliterate_line(transliterator, line_text):
|
||||||
# the actual transliteration of the word
|
# the actual transliteration of the word
|
||||||
t_word = transliterator.transliterate(orig_word.strip(string.punctuation))
|
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 transliteration fails, default back to the original word
|
||||||
if not t_word:
|
if not t_word:
|
||||||
t_word = orig_word
|
t_word = orig_word
|
||||||
else:
|
else:
|
||||||
|
t_word = improve_translation_formatting(orig_word.strip(string.punctuation), t_word, improve_punctuation=False)
|
||||||
|
|
||||||
# add back any stripped punctuation
|
# add back any stripped punctuation
|
||||||
if r_diff:
|
if r_diff:
|
||||||
t_word = t_word + "".join(r_diff)
|
t_word = t_word + "".join(r_diff)
|
||||||
|
|
Loading…
Reference in a new issue