To use the Cloud Translation API with Python, we must first install the Google Cloud Translate Python library.
- To do so, use the following pip command in the terminal:
pip install google-cloud-translate
- Now, as done previously, create a service account and download the credentials file. Export this file to the path for the GOOGLE_APPLICATION_CREDENTIALS environment variable.
- Next, find Cloud Translate API in the list of APIs to enable. Once done, we're ready to make translations directly from Python using GCP.