HTML handling
Learn how to translate HTML content with the DeepL API.
By default, the translation engine does not take HTML tags into account. By setting the tag_handling
parameter to html
, the API will process HTML input by extracting the text out of the structure, splitting it into individual sentences, translating them, and placing them back into the HTML structure.
For the translation of (non-HTML) XML content please see XML Handling
Splitting of newlines
The default value for the split_sentences
parameter for all requests where tag_handling=html
is nonewlines
, meaning the translation engine splits on punctuation only, ignoring newlines.
The default value split_sentences
for text translations where tag_handling
is not set to html
is 1
, meaning the translation engine splits on punctuation and on newlines.
Please note that for next-gen models, the parameter split_sentences
passed by the user is ignored and a value of nonewlines
is used for maximum translation quality.
Disable translation of elements
To prevent the translation of elements in the HTML structure, the translation engine respects the translate="no"
and class="notranslate"
attributes. In the following example, the translate="no"
attribute is used to prevent translation of the paragraph:
Last updated