Skip to main content

apps/mthive/translate/sync (post)

This method translates short texts synchronously. It can be used to implement tools similar to Google translate. Features:

  • Specify a source and target language.

  • Include the text to translate

URL

(POST) /api/apps/mthive/translate/sync

PARAMETERS

Parameters are included as a JSON object in the request body:

option

Mandatory. The translation option.

int, Mandatory

src

The source language code. Make sure to only use source languages according to the configuration.

This value can be null or set to "auto" in order to let the system detect the language.

string, Optional

trg

Mandatory. The target language code. Make sure to only use target languages according to the configuration.

string, Mandatory

txt

The text to translate

string, Mandatory

profileCompanyId

Optional. Submit using the MT Hive profile of the specified company instead of the caller's own.

Requires the caller to have cross-company order management rights (CanManageAllOrders).

When omitted or set to the caller's own company id, the caller's own profile is used (default behavior).

The submitted request remains owned by the caller — only the profile (MT engine, translation memories, parsers, option set) is borrowed from the target.

int, Optional



RESULTS

The resulting JSON object has these properties:

src

The source language code. If the language was not specified, then this is the estimated source language.

string

srct

The source language name. If the language was not specified, then this is the estimated source language.

string

trg

The target language code.

string

translation

The translated text

string

segs
words
chars

The total number of text segments, words and characters in the source text.

This is information you would typically display to the user.

int
int
int

wordsMT
wordsTM100
wordsTM110
wordsTMFuzzy

Gives advanced information on how the translation was done. Translation combines machine translation and translation memory techniques.

"wordsMT" is the total words translated by machine.

"wordsTM100" are the words translated from memories at identical match rate.

"wordsTM110" are the words translated from memories within context.

"wordsTMFuzzy" are the words translated from memories but at below identical match rate.

This information should be displayed to the user as it gives an idea of the quality of the translation: The lower the percentage of machine translation, the higher the quality.

Example:

Note: "Using translation memories" is the sum of: wordsTM100 + wordsTM110 + wordsTMFuzzy

int
int
int
int

ERRORS

The api may return errors if:

  • You are not subscribed to MT Hive or MT Hive is not configured

  • The languages or option are not in the configuration. Note that this can also happen in the case of a language detection

  • The text exceeds the maximum length

  • The caller supplied profileCompanyId of a different company but lacks CanManageAllOrders

  • The specified profileCompanyId has no MT Hive profile configured


EXAMPLES

Translation result:

CODE
{
    "src": "fr",
    "srct": "French",
    "trg": "en",
    "translation": "This is a sample translation. It includes machine translated text.",
    "segs": 2,
    "words": 10,
    "chars": 57,
    "wordsMT": 5,
    "wordsTM100": 5,
    "wordsTM110": 0,
    "wordsTMFuzzy": 0
}

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.