...
The method is: apps/tools/translatefiles/presets/project/{pid}
he 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. NOTE: This method will invalidate the file 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?, 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 |
collectLeveragedHits | Optional |
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?,. Default is false if not specified. If true, then the results will contain a file reference to download a JSON containing all the hits that were used for pre-translation of each segment. | bool?, Optional | |
callbackurl, callback | Specify a URL which will be called upon success or failure of operation. This makes polling for operation status unnecessary. See Callbacks (with asynchronous operations) | Optional |
RESULTS
The API method returns an Asynchronous operation result:
...
You can poll the status or use the callback parameter. When the operation is complete, the results are in the custom property
Code Block | ||
---|---|---|
| ||
{ "trm": { "requestid": 32230, "isbatch": false, "status": "Finished", "statusText": "Finished!" }, "custom": { [ ****** RESULTS ****** ] } } |
The custom property is a JSON object:
filetokenWordcount | The file token to download the word count results as a JSON document. The details are described here: projects/{pid}/wordcounts/{did}/{trg} but contain additional details. | string |
filetokenTranslation | The file token to download the translated file. | string |
fileTokenLeveragedHits | The |
file token to download a JSON with all hits used for pre-translation. Usemedia/get/{token} to download the JSON. The parameter See an example below this table. | string? | ||
parameters | The parameters used to word count and translate the file. These are those you submitted plus the default values populated. Example:
|
| object |
Leveraged hits
With the fileTokenLeveragedHits
token you can download a JSON with a list of the hits that were used to pre-translate the segments.
Example:
Code Block |
---|
{
"de": [
{
"docNo": "1",
"docSid": null,
"sid": 27624594,
"rid": 7837,
"sim": 100,
"ed": 1,
"st": 0,
"src": "en",
"trg": "de",
"stxt": "Good morning"
},
{
"docNo": "1-2",
"docSid": 1,
"sid": 27624595,
"rid": 7837,
"sim": 99,
"ed": 1,
"st": 0,
"src": "en",
"trg": "de",
"stxt": "How are you doing"
}
... |
The key properties of each hit are:
docNo
: The sequential segment number (string) in the document we translate: 1, 2, 3, 3-2, 3-3, etc.docSid
: Always null.stxt
: The hit’s source textsid, rid
: The hit’s numeric segment ID and resource IDsim
: The hit similarityed, st, src, trg
: The hit’s last editor, status, source and target language
EXAMPLES
We upload a Word file, see media/upload. We get back our fileToken, see below.
...