Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Instant-translate is translate5 api interface which can be used for translating text and files using the translate5 language resources (term collections, translation memories or machine translation engines).

...

Name

Type

Info

text

string

The string to translate.

source

string

The source language to translate from. Must be valid rfc5646 code.

targetstringThe target language to translate to. Must be valid rfc5646 code.


Translate a file with translate5 language resources

...

...

URL:

...

/editor/instanttranslateapi/file

...

Available Methods:

...

POST

...

Specialities:

...

Translate complete file from one language to another.

...

Currently this option is only available with SdlLanguage Cloud service. To be able to use the sdl cloud resource, and valid api key and api url need to be configured.

Mandatory configurations (Zf_configuration table):

  • runtimeOptions.LanguageResources.sdllanguagecloud.server
  • runtimeOptions.LanguageResources.sdllanguagecloud.apiKey

Please ensure that:

  • the filetype is supported (e.g. by Okapi),
  • TermTagger is running,
  • LanguageResources for the desired language-combination are available (order of their application: first termCollections, second TMs, third MTs).

Translating files can take a while.

URLMethodsParametersDescription

/editor/instanttranslateapi/fileprepare

POST

fil: multipart/form-data; the file to translate.

source: string; the

Translate file resource Layout

Name

Type

Info

file

multipart/form-data

The string to translate.

source

string

The

source language to translate from. Must be valid rfc5646 code. When no domainCode is provided this is mandatory.

target

: string

The

; the target language to translate to. Must be valid rfc5646 code. When no domanCode is provided this is mandatory.
domainCode

string

Unique sdl language cloud engine id(domainCode).

Step 1: Prepare a task for import of the file and run the pretranslation.

Response

...

(example):

...

{

"

fileId

taskId":"

5bc89c96a901be0001cca190

539"

}

  • the fileId is unique file id used to get the file download url

Get translation file url

URL:

/editor/instanttranslateapi/
url
fileimport

Available Methods:

GET

Specialities:

Get the download url for the translation file

Availability:

-

Get translate file resource Layout

...

Name

...

Type

...

Info

...

taskId: int; the taskId given in the repsonse of step 1

Step 2: Run the import of the task with the pretranslation.

As long as the import is running, the response in step 3 for this file will say "isImporting" instead of returning the download-link. You might need to repeat step 3 until you get the link.

The translated files are available until their configured lifetime is over; then they will be removed automatically.

Response (example): {"taskId":"539"}

/editor/instanttranslateapi/filelistGET

Step 3: Get a list of all pretranslations that are currently available for the InstantTranslate-user including their downloadUrl.

Response: allPretranslatedFiles with the data for each pretranslation-file:

  • array[taskId] = array(taskName, downloadUrl, removeDate)
  • downloadUrl: 'isImporting' | 'isErroneous' | 'isNotPretranslated' | url (the url starts a common task-export; the translated file is included in the exported ZIP)

Response layout:

{

"downloadUrl":"https://www.lc-api.sdl.com/file-translations/5bc89c96a901be0001cca190/translated-file"

}

use the url to download the file


Configuration of InstantTranslate

runtimeOptions.LanguageResources.searchCharacterLimitmap
Maximum character per language resource allowed for search. The configuration key is the language resource id, and the value is the character limit. Ex: {{"1": 100},{"2": 300}}
runtimeOptions.InstantTranslate.pretranslationTaskLifetimeDaysint2How many days do you want to keep pretranslated files before the system removes them?