Translation context

Learn how the DeepL translation engine considers the broader context of a source text or document when translating.

This article provides guidance for using context to improve translation quality with the DeepL API.

Alpha feature: context parameter

For text translation, DeepL now supports a context parameter, which makes it possible to provide additional context that can influence a translation result, but will not actually be translated itself.

You can learn more about the context parameter in the text translation API reference.

The context parameter is an alpha feature, meaning it could be deprecated without advance notice. If we do deprecate the feature, requests using the context parameter will not break, and the context will simply be ignored.

Text Translations With Multiple text Parameters

When calling the translate endpoint for text translation, it’s possible to send multiple text parameters in a single request.

The DeepL engine will only consider context in the scope of each individual text parameter within an API request. Said another way, the engine will not consider the broader context across multiple text parameters, even if these multiple text parameters are included in the same API request.

Therefore, if you want to ensure the translation engine can utilize context in your API requests, we recommend the following.

  • Include as much relevant context as possible in each text parameter, and if possible, do not split up a request into multiple text parameters.

  • If you do need to split a large text into multiple text parameters within a single request, try to break up the text based on e.g. paragraphs or another logical “context boundary”, so that context in each text parameter is as complete as possible.

Document Translation

The DeepL engine also utilizes the broader context of a document when translating documents.

If your document does not fit within the maximum upload limit, you’ll likely need to break up the document into multiple, smaller documents for translation. When this is the case, we recommend choosing logical “context boundaries” (such as chapters of a book or sections of a PowerPoint presentation) when breaking up your large document into smaller documents that fit within the maximum upload limit.

Context in XML and HTML Handling

When using tag_handling=xml or tag_handling=html in text translation, the translation engine will consider the broader context of sentences that are close to one another and will not use tags as a “context boundary”. That is, the engine can consider context “across” different tags within the XML or HTML snippet.

As mentioned above, the engine will only consider context in the scope of each individual text parameter within a text translation request.

Translating Short Text Snippets

When translating short text snippets that contain sparse context (such as product names on an e-commerce website or article titles on a news website), consider including additional context in the translation request when possible.

For example, if using HTML handling to translate product information from an e-commerce website, you can consider sending the product name and product description (plus any other available context) in a single text translation request and within the same text parameter, so that the engine can refer to the context from the product description when translating the product name and vice versa.

Using Glossaries

Glossaries make it possible to specify your own translations for words and phrases so that you can customize your translations in a consistent way. For use cases that require translating brand-, product-, or industry-specific terminology, glossaries can help to ensure accurate, high-quality translations without the need to manually edit these terms in the translation output.

DeepL’s glossaries go beyond a simple “find and replace” and will adapt the formulation of translations based on glossary entries, accounting for factors such as grammatical gender and plural forms.

A glossary term might also influence the translation result as a whole (i.e. beyond the glossary term itself) if the glossary term changes the context of the source text.

Dernière mise à jour