Closed gdillo closed 9 months ago
@gdillo
Hello friend. In order to solve your problem, we first need to figure out what causes the spaces
to disappear. There are two reasons. The first is the preprocessing of the translated text. I did perform a strip
operation in order to accurately count the length of the input text, avoid translation errors, and improve translation efficiency. The second is, that even if I don't preprocess the space strip
, will the translation service itself perform the same processing, causing the translated text to be missing meaningless spaces
?
Therefore, it is recommended that you handle the issue of spaces
separately from the translation service.
Debug Tips
What happened?
Using .translate_html (with translator='google') returns HTML with leading and trailing whitespace removed from all tags.
casehtml = ts.translate_html(casehtml, translator='google')
Is there a way to preserve the whitespace?
APP Version
5.8.9
Python Version
3.11
Runtime Environment
Windows 10
Country/Region
UK
Relevant log output
No response
Screenshots
Code of Conduct