Skip to content

The translation of HTML code containing comments fails #157

@bibich

Description

@bibich

When I translate HTML code that contains HTML comment Deepl throws an exception :

Bad request, message: Tag handling parsing failed, please check input.
'text without parent'

If I remove the HTML comment the translation is done successfully. Also with tag_handling_version parameters set to "v1" no errors are thrown.

text = """
<!-- this is a comment -->
<p>a paragraph</p>
<p>another</p>
"""
translator = deepl.Translator(key)
result = translator.translate_text(
    text,
    source_lang="EN",
    target_lang="FR",
    tag_handling="html",
    tag_handling_version="v2",
)

current version of deepl-python is 1.28.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions