Lilt API Binding for Javascript
All URIs are relative to https://api.lilt.com
Method | HTTP request | Description |
---|---|---|
batchTranslateFile | POST /v2/translate/file | Translate a File |
downloadFile | GET /v2/translate/files | Download translated file |
monitorFileTranslation | GET /v2/translate/file | Monitor file translation |
translateSegmentPost | POST /v2/translate | Translate a segment |
[TranslationInfo] batchTranslateFile(fileId, memoryId, opts)
Translate a File
Start machine translation of one or more Files that have previously been uploaded. The response will include an `id` parameter that can be used to monitor and download the translations in subsequent calls. Example CURL: ```bash curl -X POST 'https://api.lilt.com/v2/translate/file?key=API_KEY&fileId=583&memoryId=2495&configId=123&withTM=true' ```
import LiltNode from 'lilt-node';
let defaultClient = LiltNode.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';
// Configure HTTP basic authorization: BasicAuth
let BasicAuth = defaultClient.authentications['BasicAuth'];
BasicAuth.username = 'YOUR USERNAME';
BasicAuth.password = 'YOUR PASSWORD';
let apiInstance = new LiltNode.TranslateApi();
let fileId = "fileId_example"; // String | List of File ids to be translated, comma separated.
let memoryId = "memoryId_example"; // String | Id of Memory to use in translation.
let opts = {
'configId': 3.4, // Number | An optional pararameter to specify an import configuration to be applied when extracting translatable content from this file.
'withTM': true // Boolean | An optional boolean parameter to toggle the use of Translation Memory in the translation of the file.
};
apiInstance.batchTranslateFile(fileId, memoryId, opts).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
fileId | String | List of File ids to be translated, comma separated. | |
memoryId | String | Id of Memory to use in translation. | |
configId | Number | An optional pararameter to specify an import configuration to be applied when extracting translatable content from this file. | [optional] |
withTM | Boolean | An optional boolean parameter to toggle the use of Translation Memory in the translation of the file. | [optional] |
Blob downloadFile(id)
Download translated file
Download a translated File. Example CURL: ```bash curl -X GET 'https://api.lilt.com/v2/translate/files?key=API_KEY&id=1' ```
import LiltNode from 'lilt-node';
let defaultClient = LiltNode.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';
// Configure HTTP basic authorization: BasicAuth
let BasicAuth = defaultClient.authentications['BasicAuth'];
BasicAuth.username = 'YOUR USERNAME';
BasicAuth.password = 'YOUR PASSWORD';
let apiInstance = new LiltNode.TranslateApi();
let id = "id_example"; // String | A translation id.
apiInstance.downloadFile(id).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
id | String | A translation id. |
Blob
[TranslationInfo] monitorFileTranslation(opts)
Monitor file translation
Get information about the one or more Files that are being translated with machine translation. Query filters are optional but at least one must be provided. Example CURL: ```bash curl -X GET 'https://api.lilt.com/v2/translate/file?key=API_KEY&translationIds=1,2&fromTime=1607966744&toTime=1707966744&status=InProgress' ```
import LiltNode from 'lilt-node';
let defaultClient = LiltNode.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';
// Configure HTTP basic authorization: BasicAuth
let BasicAuth = defaultClient.authentications['BasicAuth'];
BasicAuth.username = 'YOUR USERNAME';
BasicAuth.password = 'YOUR PASSWORD';
let apiInstance = new LiltNode.TranslateApi();
let opts = {
'translationIds': "translationIds_example", // String | List of translation ids, comma separated
'status': "status_example", // String | One of the translation statuses - `InProgress`, `Completed`, `Failed`, `ReadyForDownload`
'fromTime': 3.4, // Number | Results after this time (inclusive) will be returned, specified as seconds since the Unix epoch.
'toTime': 3.4 // Number | Results before this time (exclusive) will be returned, specified as seconds since the Unix epoch.
};
apiInstance.monitorFileTranslation(opts).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
translationIds | String | List of translation ids, comma separated | [optional] |
status | String | One of the translation statuses - `InProgress`, `Completed`, `Failed`, `ReadyForDownload` | [optional] |
fromTime | Number | Results after this time (inclusive) will be returned, specified as seconds since the Unix epoch. | [optional] |
toTime | Number | Results before this time (exclusive) will be returned, specified as seconds since the Unix epoch. | [optional] |
TranslationList translateSegmentPost(opts)
Translate a segment
Translate a source string. Setting the `rich` parameter to `true` will change the response format to include additional information about each translation including a model score, word alignments, and formatting information. The rich format can be seen in the example response on this page. By default, this endpoint also returns translation memory (TM) fuzzy matches, along with associated scores. Fuzzy matches always appear ahead of machine translation output in the response. The maximum source length is 5,000 characters. Usage charges apply to this endpoint for production REST API keys.
import LiltNode from 'lilt-node';
let defaultClient = LiltNode.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';
// Configure HTTP basic authorization: BasicAuth
let BasicAuth = defaultClient.authentications['BasicAuth'];
BasicAuth.username = 'YOUR USERNAME';
BasicAuth.password = 'YOUR PASSWORD';
let apiInstance = new LiltNode.TranslateApi();
let opts = {
'body': new LiltNode.TranslateSegmentBody() // TranslateSegmentBody |
};
apiInstance.translateSegmentPost(opts).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
body | TranslateSegmentBody | [optional] |