wagtail / wagtail-localize

Translation plugin for Wagtail CMS
https://wagtail-localize.org/
Other
216 stars 83 forks source link

Incorrect translations with libretranslate, but only through wagtail-translate. #799

Closed Hafnernuss closed 1 month ago

Hafnernuss commented 1 month ago

Hi!

I've set up my own libretranslate service and tried it out. It seems to mostly work, but somehow the translation is wonky, but only if done through the wagtail-translate ui. An example (from german to english):

image

(The "Spare" in the translation is wrong. It should be "Save" or something similar, and the html markup is wrong)

If I enter it directly in my libretranslate ui, I get the following (which is correct)

<b>Save time<br/></b>by simply efficient organization 

If I do it via a normal POST request, it also works: image

Is there any easy way to increase logging verbostiy for the requests that are being done? I suspect it has something to do with the HTML tags, because texts without them seem to work fine.

If necessary, I can provide a public link to my translate instance together with an API key.

Hafnernuss commented 1 month ago

It appears that in libretranslate.py, the following flag is missing:

"format": "html",

which confuses libretranslate as soon as there are html tags in the request.