deepl-node icon indicating copy to clipboard operation
deepl-node copied to clipboard

Bad request on unsupported formality

Open mattbrannon opened this issue 3 years ago • 2 comments

Currently, a request that specifies a formality setting not yet supported by DeepL returns an error without a translation. DeepLError: Bad request, message: 'formality' is not supported for given 'target_lang'.

Maybe a more user friendly alternative would be to just ignore any unsupported options in the request, possibly attaching a warning message to the response informing the user of their mistake. This way, applications that call the DeepL api won't break when supplied an invalid configuration.

mattbrannon avatar Jun 09 '22 13:06 mattbrannon

Hi Matt, this is a good suggestion, thanks.

It will take some time to change to our backend; I'll post an update when it is changed.

daniel-jones-deepl avatar Jun 10 '22 09:06 daniel-jones-deepl

I just want to add my support for this feature, it would be easier to set up the requests that way.

TasseDeCafe avatar Jul 26 '22 14:07 TasseDeCafe

Hello again, we've added two new allowed formality values: prefer_less and prefer_more. They have the same function as less and more respectively if the target language supports formality, otherwise they fallback to the default formality. With these two values you will not get the error mentioned above.

daniel-jones-deepl avatar Sep 30 '22 08:09 daniel-jones-deepl