...
(POST) /api/apps/tools/translatefiles/translate
PARAMETERS
Tip: A helper method exists to get some parameters from a project: Word count profile, Document format profile, Project memory and attached resource IDs.
The method is: apps/tools/translatefiles/presets/project/{pid}
The body must contain a JSON object with these properties:
Original file | ||||
fileToken | The token that references the original file to process. Use media/upload to upload your file and to obtain a token. | string, Mandatory | ||
src | Source locale. This is the locale of the original file. | string, Mandatory | ||
trg | Target locale. This is the locale into which to translate. | string, Mandatory | ||
formatId | Optional ID of a specific document format configuration to use. The configuration defines how to extract text from the original file. The system selects a configuration as follows:
To enumerate all configurations, see: Document formats | int?, Optional | ||
formatProfileId | Optional ID of a document format profile from which to select a format configuration. Profiles are configured online at Settings > Document format profiles. Tip: Use helper method: apps/tools/translatefiles/presets/project/{pid} To enumerate all profiles, see: Document format profiles | |||
Translation and word count | ||||
wordcountProfileId | Optional word count profile to use. The profile defines how to leverage memories, how to pre-translate from memories, whether to use MT and more. If not set, then the system selects the alphabetically first word count profile configured online at Settings > Word count profiles. Tip: Use helper method: apps/tools/translatefiles/presets/project/{pid} To enumerate word count profiles, see Word count profiles | int?, Optional | ||
resourceIds | Optional list of translation/project memories or term bases to use for leveraging (as well as pre-translation). If not set, then the system will only pre-translate with MT (if a system is enabled in the word count profile) Tip: Use helper method: apps/tools/translatefiles/presets/project/{pid} to get project memory ID and attached resource IDs for a reference project. | int[]?, Optional | ||
disableMT | Optional. Default is false.
| bool?, Optional | ||
copySourceToTarget | Optional. Default is true if not specified.
| bool?, OptionalPreset properties from project | ||
projectPreset | This can be used to preset properties from a project's configuration. Optional. | object?, Optional | ||
projectPreset.pid | Mandatory. A project ID. | int, Mandatory | ||
projectPreset.setFormatProfile | Optional bool. If true then the formatProfileId is set to the project format profile (if any was assigned to the project) | bool?, Optional | ||
projectPreset.setWordcountProfile | Optional bool. If true then the wordcountProfileId is set to the project's wordcount profile (if any was assigned to the project) | bool?, Optional | ||
projectPreset.setResourcesAttached | Optional bool. If true then all memories/termbases attached to the project are used for word counting and pretranslation. If resourceIds was set, then the project resources are appended. | bool?, Optional | ||
projectPreset.setResourcesProjectMemory | Optional bool. If true, then the project memory is used for word counting and pretranslation. If resourceIds was set, then the project resources are appended. | bool?, Optional | ||
Results | ||||
buildTranslatedFile | Optional. Default is true if not specified. If true then the results will contain a file reference to download the translated file. Use false if you are only interested in the word count information. | bool?, Optional | ||
callbackurl | Optional URL which will be called upon success or failure of operation. This makes polling for results (see below) unnecessary. URL is called as POST request with operation result included in the body, see "RESULTS" chapter below for the JSON format. Suggestion: Include your own references in the URL, example: http://callmeback.mycompany.com?operationid=22222&mydata=abcde | string?, Optional |
...
The method returns a file. It contains a JSON object with these properties:
...
object
...
with
...
Each element in segments has these properties:
key | Segment key | string | ||
format | The content format such as "plain" or "html_1". | string | ||
dt | The last date of change of any property of the segment (texts, status, ...) | datetime | ||
bsid | Sequential number assigned for display in the translation editor. This number may change with push requests. | int | ||
cfs | Segment level custom fields (null if there are none). Each array element has properties id (custom field ID) and v (custom field value) | object[]? | ||
texts | A dictionary of texts. The key is the locale and the value a text object, see below.
| object[] |
Each element in texts has these properties:
v | The text. | string | |
st | The status in Wordbee Translator. 0 = Neutral (gray color), 1 = OK (green color), 2 = Problem (red color). IMPORTANT: This is an important information. We strongly recommend to not update your systems with any texts that are in red status. Red status means that the translation team either did not yet work on the text or they found an issue. You should only consider texts in 0 or 1 status, depending on how the translation team is organized. Some teams may instruct translators to explicitly set translation status to "green" in which case you may only want to read those. | int | |
bk | The bookmark in Wordbee Translator. 0 = none, 1 = blue, 2 = red | int | |
ed | Last editor. See Last Editor (Enumeration) | int | |
dt | Date of modification of text. | datetime | |
cfs | Custom fields (null if there are none). Each array element has properties id (custom field ID) and v (custom field value) | object[]? | |
lbls | Labels (null if there are none). Each array element has properties id (label ID) and v (selected label value) | object[]? | |
cms | Comments attached to text. An array of objects with these properties:
| object[]? | vc |
Code Block |
---|
{
"v": "<p>Hello world</p>",
"vc": true,
"st": 2,
"bk": 0,
"ed": 0,
"dt": "2019-10-03T15:11:02.4421331Z"
} |
EXAMPLES
Basic results without custom fields, labels and comments:
Code Block |
---|
{
"type": "Wordbee Flex File Export",
"version": "1.0",
"dsid": 3833,
"did": 9371,
"major": null,
"minor": null,
"segments": [{
"key": "1001",
"dt": "2019-05-22T07:03:50.3871180Z",
"format": "plain",
"bsid": 2,
"texts": {
"en": {
"v": "Hello world",
"st": 0,
"bk": 0,
"ed": 0,
"dt": "2019-05-20T21:43:37.562205Z"
},
"de": {
"v": "Guten Tag",
"st": 0,
"bk": 0,
"ed": 0,
"dt": "2019-05-20T21:43:37.562205Z"
}
}
},
{
"key": "1000",
"dt": "2019-05-22T07:03:50.3871180Z",
"format": "plain",
"bsid": 1,
"texts": {
"en": {
"v": "<p>Hello dear world</p>",
"st": 0,
"bk": 0,
"ed": 0,
"dt": "2019-05-20T21:43:37.5542057Z"
},
"de": {
"v": "",
"st": 2,
"bk": 0,
"ed": 0,
"dt": "2019-05-16T12:23:37.8150027Z"
}
}
}]
} |
Basic results with custom fields, labels and comments:
...