1

Created a glossary resource -- Step 1) Kept a glossary csv sheet in GCS. Step 2) request.json as below -

{
  "name":"projects/my-project-id/locations/us-central1/glossaries/my-glossary-id",
  "languagePair": {
    "sourceLanguageCode": "en",
    "targetLanguageCode": "ru"
    },
  "inputConfig": {
    "gcsSource": {
      "inputUri": "gs://my-bucket-id/my-glossary-id.csv"
    }
  }
}

Step 3) curl -X POST -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) -H "Content-Type: application/json; charset=utf-8" -d @request.json https://translation.googleapis.com/v3/projects/my-project-id/locations/us-central1/glossaries

Got the below as response -

{
  "name": "projects/my-project-id/locations/us-central1/operations/20210322-02431616406238-605596c9-0000-21a9-91e6-94eb2c045d66",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.translation.v3.CreateGlossaryMetadata",
    "name": "projects/my-project-id/locations/us-central1/glossaries/my-glossary-id",
    "state": "RUNNING",
    "submitTime": "2021-03-22T09:43:58.973617420Z"
  }
}

BUT when i want to list the glossaries - It returns a blank :-

curl -X GET -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) https://translation.googleapis.com/v3/projects/my-project-id/locations/us-central1/glossaries

the response is as follows -- {}

ALSO - when i use this glossary to translate my text - it throws below error -

{
  "error": {
    "code": 404,
    "message": "Glossary not found.; Failed to initialize a glossary.",
    "status": "NOT_FOUND"
  }
}

1 Answers1

0

Some things to verify:

I wrote a walkthrough and made a repo with example code if you'd find that helpful too:

https://medium.com/@swekage/the-ultimate-guide-to-setting-up-google-translates-glossaries-in-javascript-d9cdff41d9ed

https://github.com/swekage/google-translate-glossary

sweKage
  • 11
  • 1