Translate text from one language to another
supercontrast
is straightforward. You need to provide the text to translate, specify the source and target languages, and choose the provider you want to use.
In this example, we’ll use Task.TRANSLATION
with Provider.AZURE
(Microsoft’s Azure Translator service) to translate text from English (source_language="en"
) to French (target_language="fr"
).
Note: Language codes can be found here.
Task.TRANSLATION
, the request schema is defined by TranslationRequest
and the response schema is defined by TranslationResponse
.
TranslationRequest
text
: a string of the text to be translated.text
: a string of the translated text