Google Translation V3 API - 词汇表资源错误

问题描述

创建了词汇表资源—— 步骤 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 "Authorization: Bearer "$(gcloud auth application-default print-access-token) https://translation.googleapis.com/v3/projects/my-project-id/locations/us-central1/glossaries

响应如下——{}

另外 - 当我使用这个词汇表翻译我的文本时 - 它会引发以下错误 -

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

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)