DeepLcom / deepl-php

Official PHP library for the DeepL language translation API.
MIT License
207 stars 22 forks source link

Wrong behavior with TranslateTextOptions::TAG_HANDLING xml and notranslate tag #47

Open VincentLanglet opened 6 months ago

VincentLanglet commented 6 months ago

Hi @daniel-jones-deepl,

I discover another bug with the TranslateTextOptions::TAG_HANDLING => xml (But different from https://github.com/DeepLcom/deepl-php/pull/43#issue-2146235966)

Translating FR to ES

En seulement 4 mois, l’établissement a généré <strong wg-1="">30k€ de <notranslate>ingresos</notranslate></strong> et a enregistré <strong wg-2="">plus de 80 nouvelles réservations</strong> suite à l’envoi d’e-mails marketing personnalisés

En sólo 4 meses, el establecimiento generó <strong wg-1="">30k€ en <notranslate>ingresos</notranslate></strong> y registró <strong wg-2="">más de 80 nuevas reservas</strong> tras el envío de emails de marketing personalizados.

Translating FR to ES with TranslateTextOptions::TAG_HANDLING => xml

En seulement 4 mois, l’établissement a généré <strong wg-1="">30k€ de <notranslate>ingresos</notranslate></strong> et a enregistré <strong wg-2="">plus de 80 nouvelles réservations</strong> suite à l’envoi d’e-mails marketing personnalisés

<strong wg-1=""> <notranslate>ingresos</notranslate>En sólo 4 meses, el establecimiento generó</strong> <strong wg-1="">30.000 euros</strong> y registró <strong wg-1=""></strong> <strong wg-2="">más de 80 nuevas reservas</strong> tras el envío de correos electrónicos de marketing personalizados.

I would expect a result similar to the first one.

Could you confirm and forward the issue to your backend team ? Thanks.

daniel-jones-dev commented 6 months ago

HI @VincentLanglet, thanks for the report. I was able to reproduce the problem by also setting ignore_tags to include notranslate tag. This is indeed a strange problem, some target languages (eg en-US) seem to handle it correctly, others have a similar problem. I've forwarded it to our backend team.

myfbone commented 4 months ago

Same problem with German to Polish language pair

ricardoaraujo330 commented 3 months ago

Same here, please fix it asap 🙏