I'm looking into the DEEPL API documentation and would like to know if anyone have been able to use it to output multiple translated languages from one target language?
Using this call:
POST /v2/translate
curl -X POST 'https://api-free.deepl.com/v2/translate' \
-H 'Authorization: DeepL-Auth-Key API KEY' \
-d 'text=Hello%2C%20world!' \
-d 'target_lang=DE'
Getting this response:
{
"translations": [
{
"detected_source_language": "EN",
"text": "Hallo, Welt!"
}
]
}
Now what I'd like to do, is to add several languages in the one call and get the translation for each one of those. The idea would be to use less tokens by not sending several calls for each language output. Something like this maybe?:
POST /v2/translate
curl -X POST 'https://api-free.deepl.com/v2/translate' \
-H 'Authorization: DeepL-Auth-Key API KEY' \
-d 'text=Hello%2C%20world!' \
-d 'target_lang=DE' \
-d 'target_lang=SV'
Desired output:
{
"translations": [
{
"detected_source_language": "EN",
"text": "Hallo, Welt!"
},
{
"detected_source_language": "EN",
"text": "Hej världen"
}
]
}
Does anyone know if this is do-able?
This is currently not supported by the DeepL API, you will need to make one API call per target language. You can find the DeepL API docs here.