Auto Translation with Google Translate API and Frontend Settings

I am trying to use the Auto Translate Feature on a hosted instance.
I saw some topics that there is a possibility to use the Google Translate API, but there is no way to find a procedure to get it working.

In this topic its mentioned:

And here are some codes already provided, but no clue how to implement them:

It would be very nice to have some readme, environment variables and frontend settings to configure auto translation.

The Rules Module is very extendable for that, like giving the possibility to make a rule with the condition that main language is available and than adding translations via the translation provider if a secondary language field is empty.

Looking forward to hear your thoughts about that.
Have a nice day.

The auto translate feature is basically this button:

You can configure deepl or google translate with this settings. Perhaps this should be added to the documentation?

But the authentication for google translate is a little bit complicated:

Perhaps there is another API with api keys, not sure. Therefore I recommend deepl.

There is no extension for rule actions yet, but it is makes sense to think about that. Perhaps you want to change this feature request?

Thanks for the quick reply.
I am using GoogleCloud Translation API already on other projects.

As I am using Docker based Squidex how do I make these settings you mentioned?

Google Translation API has either Oauth2 or Service Account login with Private Key as far a I know, none of which is mentioned in the settings above.

Has anyone already used it for translation in Squidex and can provide the settings logic?

It is mentioned in the article I have linked, you have to put the key file to the file system and define the

GOOGLE_APPLICATION_CREDENTIALS settings.

The configuration model is described here:
https://docs.squidex.io/01-getting-started/installation/configuration#configuration-model

so you also have to set TRANSLATIONS__GOOGLECLOUD__PROJECTID

Nice, thank you. If anyone has a walkthrough for the Google Cloud Translate it would be really nice.

Should I mention my ideas in a feature request here unter support.squidex.io or on GitHub?

As you wish, but there is not so much activity on github.

But if you have worked with Google Translate you should know the procedure for authentication.

ok, I will create one feature request here.

The setup of the Google Translation API is not quite working.

  1. I installed Googles CLI and
  2. Library from Translate,
  3. added the ENV “TRANSLATIONS__GOOGLECLOUD__PROJECTID” with the respective project id. 4. Authenticated with the project

but no success. (including rebooting)

Maybe someone could help provide a walkthrough.

This is not needed.

Why?

Here is what I did:

I basically followed the tutorial from Google:

  • Go to the service accounts in Google Cloud Console.
  • Ensure that the service account has necessary permissions for translate API.
  • Create a key file and download it.
  • Create a global environment variable GOOGLE_APPLICATION_CREDENTIALS that points to the key file.
  • Setup the environment variable in Squidex TRANSLATIONS__GOOGLECLOUD__PROJECTID.
  • Create a localizable fields and add a second language. I have German and English.
  • Leave all other languages except the master language empty.
  • Click the translate button.