Skip to content

Text Translation

This describes the web services that relate to text translation.

Aculab Cloud uses Google Translate to perform text translation.

Note

 This is a low level API. For information on higher level APIs see the Web Services Language Wrappers

Authorisation

This API uses basic authentication, using your cloud account username and API Access Key.

Username : cloudID/username (e.g. 1-2-0/bob@example.com)
Password : API Access Key

Translate

This API takes a PUT or POST request with the text to be translated in the request body. The text must be submitted as plain text encoded in utf-8. The maximum content size is 102400 characters. The URL parameters are used to specify the source and target language codes.

Request

URL : https://ws-[cloudID].aculabcloud.net/translate/v1/translate
Methods : PUT, POST
Parameter Value Description
target_language required The language code of the intended translation Use a language code from Translation Languages.
source_language optional The language code of the source text. If not specified the source language will be detected. However we recommend specifying the source language to improve accuracy. Use a language code from Translation Languages.

Response

A JSON object with the following parameters:

Parameter Value Description
request_id string always
target_language_name string always
detected_source_language string when the request has not specified a source language
source_language_name string always
translation string always

Example

Request
https://ws-[cloudID].aculabcloud.net/translate/v1/translate?target_language=es<br></br>
With the body containing "The text to be translated".
Response
  {
    "request_id": "tr-23b2cc6d_1.0066bcb579.000008",
    "target_language_name": "Spanish",
    "detected_source_language": "en",
    "source_language_name": "English",
    "translation": "El texto a traducir"
  }

Supported Languages

This returns a list of objects detailing the supported languages.

Request

URL : https://ws-[cloudID].aculabcloud.net/translate/v1/supported_languages
Methods : GET

Response

A JSON array of objects describing the supported languages. The objects have the following parameters:

Parameter Value Description
language_name string the English name of the language.
language string the language code of the language.

Example

Request
https://ws-[cloudID].aculabcloud.net/translate/v1/supported_languages
Response
  [
    {
        "language_name": "Abkhaz",
        "language": "ab"
    },
    {
        "language_name": "Acehnese",
        "language": "ace"
    },
    ...
    {
        "language_name": "Zapotec",
        "language": "zap"
    },
    {
        "language_name": "Zulu",
        "language": "zu"
    }
  ]