This is an example site using the Google Cloud Translation API Python SDK
The lab shows students how to initially install the site, but the principals of how it works will need to be expanded upon. I recommend showing the contents of the main.py file and templates/index.html file to students, and using this working example as a starting point to use in their own sites.
This application uses the following main file structure:
gce-uconn-translate
├─ requirements.txt
├─ app.yaml
├─ main.py
├─ templates
│ ├── index.html
A list of the required packages for the app
A config file for google app engine
The main application
HTML used in the app. Only one page is used.
Create a new project (if needed)
Enable the Cloud Translation API
In the search box at the top of your Google Cloud Console, type in "translate" and select "Cloud Translation API".
On the Cloud Translation API page, click Enable.
Download and Deploy the Site
Start Google Cloud Shell by clicking the cloud shell icon on the top right of your screen.
Create a Project Folder
mkdir translate
Enter the Project Folder
cd translate
Pull the project
git clone https://github.com/philku/gce-uconn-translate.git .
Deploy the project
gcloud app deploy
You may be asked to select a region for your app. Choose the region closest to you.
You will be verify the details of the deployment. Hit enter.
Open the site by typing:
gcloud app browse
This should open your site in a new window. If it does not, click on the link.
You should now be at the site