digitalfabrik / integreat-cms

Simplified content management back end for the Integreat App - a multilingual information platform for newcomers
https://digitalfabrik.github.io/integreat-cms/
Apache License 2.0
56 stars 35 forks source link

DeepL API: supported languages in bulk actions #1198

Closed JoeyStk closed 2 years ago

JoeyStk commented 2 years ago

Motivation

So far for every language there is an option to automatically translate via DeepL inside the dropdown. However for languages, that are not supported by DeepL they will get a notification later on. This is not ideal. It would be better to show the option to automatically translate via DeepL only for languages that are supported by DeepL inside the dropdown.

Proposed Solution

This can be achieved by calling the check_availability-Funktion from the DeepL client when the bulk action is generated.
Also add a tool-tip to inform the user about why some languages are supported and others are not.

Additional Context

This is part of Johannes' final exam.

timobrembeck commented 2 years ago

When reviewing #1135, I also had the idea to do the check only once on server start (and not every time the bulk actions get rendered):

Since the supported languages will most likely not change very frequently, it's probably a bit too much overhead to call the DeepL API every time for this. Maybe we could retrieve the supported languages initially during the server start similar to the GVZ API? And then, the supported languages could e.g. be retrieved via apps.get_app_config("deepl_api").supported_languages or similar. This would also make it easier to disable the bulk action when the language is not supported.