我尝试使用API(https://github.com/zanata/zanata-platform/wiki/Raw-File-REST-API#source-document-upload)将.pot文件发送到 Zanata 4
我的Zanata服务器:// 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等,但结果是一样的。 我该如何解决?
答案 0 :(得分:0)
您必须使用类型列表中的类型
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