Hi all, I just got the Google Translate api working on my KM. As usual the most difficult part is to get the google api credentials registered on the Mac's environment. Please see this video Translating speech using cURL - YouTube for the process. I used the authorization via service accounts method. And it worked as per the video. This link is helpful too. Setup | Cloud Translation | Google Cloud especially the section on " Using the service account key file in your environment."
After that, I used the following macro to call for google translate. I have also another macro that sets the target language (%Variable%lang%). By default, the target language is english.
I use a JSON parser called JQ to process the JSON results. But you don't have to use that. A simple search and extract function is sufficient to extract the translated results.
To use the shell script, I have to include source ~/.bash_profile to include the environmental variables that referenced the google api credentials.
Google Translation API Macro (v10.0.2)
Google Translation API.kmmacros (4.8 KB)