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 |
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 | The total number of text segments, words and characters in the source text. This is information you would typically display to the user. | 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
EXAMPLES
Translation result:
{ "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 }
Copyright Wordbee - Buzzin' Outside the Box since 2008