Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeepL: unsupported languages #473

Open
jakehedlund opened this issue May 17, 2022 · 2 comments
Open

DeepL: unsupported languages #473

jakehedlund opened this issue May 17, 2022 · 2 comments

Comments

@jakehedlund
Copy link

Describe the bug
A misleading error message (400: Bad Request) is returned when unsupported languages are used with the DeepL API. Since DeepL only supports a rather small subset of languages, it would be nice to be informed when a selected target language was unsupported by the API.

There is an endpoint to fetch supported langs documented here: https://www.deepl.com/docs-api/other-functions/listing-supported-languages/

To Reproduce
Attempt to translate text from any language to an unsupported one (e.g. Korean [ko]). The error message displayed is: DeepL: Response status code does not indicate success: 400 (Bad Request)

Expected behavior
A more helpful message should be shown (e.g. The target language is not supported by this API)

@ruvyas
Copy link

ruvyas commented May 21, 2022

Looking at the DeepL API, it doesn't seem to return any specific error regarding unsupported language. Just 400 (Bad Request). We can't assume all 400 BAD REQUEST are going to be due to unsupported language issue. Does it make sense to make an additional API call to /languages to check if the language is supported or not?

@jakehedlund
Copy link
Author

I would make the supported languages API call the first time the user requests a DeepL translation. Then just cache the list for the lifetime of the extension/program and pop up a warning message when an unsupported language is used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants