Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

location variable setting for the Google Cloud Translation API (Advanced)

Does anyone know which locations can be used to set the variable "location" in the following code snippet from a .js program designed to use Google Cloud Translation (Advanced) to translate asynchronously a .docx file stored in the subdirectory of a bucket into another supported language?

 

// Set your project ID, location and bucket name here
const projectId = ....
const location = ....
const bucketName  = ....

My VM instance is located in "europe-north1-a", but is it possible to also use this as a valid region/zone to set the "const location" variable to? I don't  see anything about this in the documentation.

 

 

Solved Solved
0 3 1,582
1 ACCEPTED SOLUTION

Hi @legrandtimonier

Welcome back to Google Cloud Support,

The area "europe-north1-a" is a valid location, You may able to generate resources like buckets and VM instances there, you may use it as the location value for the location variable in the code snippet you gave.

The location parameter of the Google Cloud Translation API indicates the region in which the Translation API service is hosted. The following locations are listed as being accessible for the API service in the official documentation:

  • asia-east1
  • europe-west2
  • us-central1

To reduce latency and increase speed while using services, You may pick the area that is either closest to your users or where your resources are located.

Here are some references that might help you:
https://cloud.google.com/compute/docs/regions-zones?_ga=2.183424358.-1392753435.1676655686

https://cloud.google.com/translate

View solution in original post

3 REPLIES 3

Hi @legrandtimonier

Welcome back to Google Cloud Support,

The area "europe-north1-a" is a valid location, You may able to generate resources like buckets and VM instances there, you may use it as the location value for the location variable in the code snippet you gave.

The location parameter of the Google Cloud Translation API indicates the region in which the Translation API service is hosted. The following locations are listed as being accessible for the API service in the official documentation:

  • asia-east1
  • europe-west2
  • us-central1

To reduce latency and increase speed while using services, You may pick the area that is either closest to your users or where your resources are located.

Here are some references that might help you:
https://cloud.google.com/compute/docs/regions-zones?_ga=2.183424358.-1392753435.1676655686

https://cloud.google.com/translate

Many thanks. I suspected that "location=" in this line of code wasn't the same as the location of where my bucket, for example, is located (in my case Council Bluffs, Iowa), but I wasn't sure what the right one was for where Translation API service is hosted. I thought it might be the same as where my VM instance is hosted (europe-north1-a). Now I know that isn't it either. Thanks again for this important information.    

Hmm. I tried setting "location='europe-west2'" as the location of my
Cloud Translation API, but when I run my program I am told, among other
frightening things:

(node:4733) UnhandledPromiseRejectionWarning: Error: 3 INVALID_ARGUMENT:
Invalid location name. Unsupported location 'europe-north1-a'.
Must be 'us-central1' or 'global'.

I will try setting location to "global", hoping that does it, but having no
idea what should really be inserted as location it's just a shot in the
dark. My storage bucket is located in "us-central1", but theoretically that
should have nothing to do with the Cloud Translation API location, right?
Mystery, mystery......