
Tags may be specified as an array of strings ( ),
#Deepl translator plugin code
detected_source_lang) # "ES" the language code for Spanish # Translate into German with less and more Formality: print( detected_source_lang) # "JA" the language code for Japanese print( result. text) # "Bonjour, le monde !" # Translate multiple texts into British English result = translator. translate_text( "Hello, world!", target_lang = "FR") # Translate text into a target language, in this case, French: result = translator. The translated text, and detected_source_lang is the detected source language Translate_text() returns a TextResult, or a list of TextResultsĬorresponding to your input text(s).

There are additional optional arguments to control translation, see
#Deepl translator plugin iso
Variant according to ISO 3166-1, for example 'EN-US', or 'PT-BR'. Some target languages also include the regional Language codes are case-insensitive strings according to ISO 639-1, forĮxample 'DE', 'FR', 'JA''. The source_lang is optional, if it is unspecified the source Source_lang and target_lang specify the source and target language codes The first argument is a stringĬontaining the text you want to translate, or a list of strings if you want to To translate text, call translate_text().

Translator accepts additional options, see Configuration In production code, theĪuthentication key should not be hard-coded, but instead fetched from aĬonfiguration file or environment variable. This example is for demonstration purposes only. Import deepl auth_key = "f63c02c5-f056-." # Replace with your key translator = deepl.
