Zanata:值 'txt' 不是可识别的文档类型。这是什么意思?

Zanata: Value 'txt' is not a recognized document type. What does it mean?

我尝试使用 API (https://github.com/zanata/zanata-platform/wiki/Raw-File-REST-API#source-document-upload)

将 .pot 文件发送到 Zanata 4

my Zanata server: //my-zanata-server/zanata/rest/file/source/p1/v1?docId=document

curl -F type=txt -F file=@document.txt -F hash=`md5sum document.txt | awk '{print }'` -F first=true -F last=true -H "X-Auth-User:{username}" -H "X-Auth-Token:{api key}" "https//my-zanata-server/zanata/rest/file/source/p1/v1?docId=document"

但 Zanata 说:值 'txt' 不是可识别的文档类型。

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><chunkUploadResponse xmlns="http://zanata.org/namespace/api/"><acceptedChunks>0</acceptedChunks><errorMessage>Value 'txt' is not a recognized document type.</errorMessage><expectingMore>false</expectingMore></chunkUploadResponse>

我也发了pot,po等其他类型的,结果都是一样的。 我该如何解决?

您必须使用类型列表中的类型

GET /file/file_type_info
Accept: application/json

看起来像

[
  {
    "type": {
      "name": "GETTEXT"
    },
    "extensions": {
      "pot": "po"
    }
  },
  {
    "type": {
      "name": "HTML"
    },
    "extensions": {
      "htm": "htm",
      "html": "html"
    }
  },
  {
    "type": {
      "name": "IDML"
    },
    "extensions": {
      "idml": "idml"
    }
  },
  {
    "type": {
      "name": "JSON"
    },
    "extensions": {
      "json": "json"
    }
  },
  {
    "type": {
      "name": "OPEN_DOCUMENT_GRAPHICS"
    },
    "extensions": {
      "odg": "odg"
    }
  },
  {
    "type": {
      "name": "OPEN_DOCUMENT_PRESENTATION"
    },
    "extensions": {
      "odp": "odp"
    }
  },
  {
    "type": {
      "name": "OPEN_DOCUMENT_SPREADSHEET"
    },
    "extensions": {
      "ods": "ods"
    }
  },
  {
    "type": {
      "name": "OPEN_DOCUMENT_TEXT"
    },
    "extensions": {
      "odt": "odt"
    }
  },
  {
    "type": {
      "name": "PLAIN_TEXT"
    },
    "extensions": {
      "txt": "txt"
    }
  },
  {
    "type": {
      "name": "PROPERTIES"
    },
    "extensions": {
      "properties": "properties"
    }
  },
  {
    "type": {
      "name": "PROPERTIES_UTF8"
    },
    "extensions": {
      "properties": "properties"
    }
  },
  {
    "type": {
      "name": "SUBTITLE"
    },
    "extensions": {
      "sub": "sub",
      "srt": "srt",
      "sbt": "sbt",
      "vtt": "vtt"
    }
  },
  {
    "type": {
      "name": "TS"
    },
    "extensions": {
      "ts": "ts"
    }
  },
  {
    "type": {
      "name": "XLIFF"
    },
    "extensions": {
      "xlf": "xlf"
    }
  },
  {
    "type": {
      "name": "XML_DOCUMENT_TYPE_DEFINITION"
    },
    "extensions": {
      "dtd": "dtd"
    }
  }
]

所以,在我的例子中,它必须是 GETTEXT