Skip to content

Translating HTML with English text to French adds HTML Tags and full sentence that is not in the input text #42

Closed
@wilhelmberghammer

Description

@wilhelmberghammer

Describe the bug
When translating a English text with HTML elements to French, the response contains unexpected additional HTML Tags and often a full sentence that was not in the input.

To Reproduce
Minimal JS Script to reproduce the Error (last tested on March 9th 2024 6PM CET)

const deepl = require('deepl-node')
const authKey = "<authkey>"
const translator = new deepl.Translator(authKey)

async function translate(targetLang) {
	const result = await translator.translateText('<p><strong>Testing the system</strong></p>', 'en', targetLang, tag_handling = 'html')
	console.log(result)
}

translate('de')
translate('fr')

This results in the following responses:

{
  text: '<p><strong>Test des Systems</strong></p>',
  detectedSourceLang: 'en'
}
{
  text: "</p><strong>Tester le système</strong></p><strong></p><strong>La mise en place d'un système de gestion de l'information est une priorité.",
  detectedSourceLang: 'en'
}

The German translation is correct but the French translation has <strong></p><strong>La mise en place d'un système de gestion de l'information est une priorité. appended to a seemingly correct result.

I've noticed that without the <strong> Tag it does not happen but I have not tested that exhaustively.

Thank you very much.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions