Skip to content

Translate Text

Shows how to translate text between languages using the DeepL API.

This example assumes using DeepL; is in scope and apiKey contains your DeepL API key.

1
2
3
4
5
6
7
8
9
using var client = new DeepLClient(apiKey);

// Translate text from English to German using the DeepL API.
var response = await client.TranslateText.TranslateTextAsync(
    request: new TranslateTextRequest
    {
        Text = ["Hello, world!"],
        TargetLang = TargetLanguage.De,
    });