deepl-php icon indicating copy to clipboard operation
deepl-php copied to clipboard

Problem with HTML translation

Open romanmuska opened this issue 1 year ago • 4 comments

Hello,

we use DeepL with tag_handling="html" but the problem is that output of html is changed e.g some of
tags are moved to other positions. How can we solve that we don't want to change any html entities and their positions.

Thanks

romanmuska avatar May 30 '24 14:05 romanmuska

Experiencing this issue as well.

Example sentence (click on Continue to continue):

<p>Klik på <span translate="no">Continue</span> for at fortsætte</p>

When using the API library, the element is moved to the beginning (Continue Click to continue):

<p><span translate="no">Continue</span> Klicka för att fortsätta</p>

The API is called like this:

$lib->translateText($string, 'da', 'sv', ['tag_handling'=>'html'])

It seems to break on nested elements, so my workaround is to move the element outside, but of course this breaks the HTML structure..

<p>Klik på </p><span translate="no">Continue</span><p> for at fortsætte</p>

FPDK avatar Nov 19 '24 15:11 FPDK

Can confirm this is happening. And it gets worse if you are using "don't translate" tags like <p translate="no">.

Tried reaching support with our account manager and they confirmed tag handling needs improvement on their end.

osiris-mm avatar Jan 07 '25 08:01 osiris-mm

@osiris-mm any progress regarding this topic at all?

marcorensch avatar Feb 07 '25 10:02 marcorensch

This is due to model issues and should be unrelated to the PHP library. We are working on a new and improved version of tag handling that should have fewer issues like this, but I can't promise a release date yet.

JanEbbing avatar Feb 07 '25 14:02 JanEbbing