1

创建了一个词汇表资源——步骤 1)在 GCS 中保留一个词汇表 csv 表。步骤 2) request.json 如下 -

{
  "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"
    }
  }
}

步骤 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

得到以下回应 -

{
  "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"
  }
}

但是当我想列出词汇表时-它返回一个空白:-

curl -X GET -H "授权:承载"$(gcloud auth application-default print-access-token) https://translation.googleapis.com/v3/projects/my-project-id/locations/us-central1/词汇表

响应如下——{}

另外 - 当我使用这个词汇表翻译我的文本时 - 它会抛出错误 -

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

0 回答 0