Compat mode Google API API Reference

Compat mode Google API

With the Compat mode Google API, translation tasks can be run by SYSTRAN Server engines using Google style translation API. In this way, only the API key and end point needs to be changed, without having to rewrite existing code.

It is recommended to use ‘Compatmode’ API only in the case of legacy developments, as it is preferable to use the SYSTRAN translation API from the start, which offers more possibilities in leveraging translations from your server.

Authentication

  • In header the access token generated from the authorization-server (ses-console) using OAuth2 Flow Client Credentials or PKCE.
Authorization: Bearer YOUR_ACCESS_TOKEN
  • In header the API Key generated from the authorization-server (ses-console)
Authorization: Key YOUR_API_KEY
  • In querystring the API Key as key parameter
?key=YOUR_API_KEY

Note about the input/output text

  • The input text passed as a URL parameter will be escaped with an equivalent of the javascript 'encodeURIComponent' function.
  • The input text must be encoded in UTF-8.
  • The output text will be encoded in UTF-8.

Language code values

The language codes to be used are the two-letter codes defined by the ISO 639-1:2002, Codes for the representation of names of languages - Part 1: Alpha-2 code standard.

Refer to the column 'ISO 639-1 code' of this list: http://www.loc.gov/standards/iso639-2/php/code_list.php.

In addition to this list, the following codes are used:

Language Code Language
auto Language Detection
tj Tajik (cyrillic script)
zh-Hans Chinese (Simplified)
zh-Hant Chinese (Traditional)
Schemes: https
Version: 1.0.0

Authentication

accessToken

"Bearer access_token" OR "Key api_key"

type
apiKey
name
Authorization
in
header

apiKey

API Key

type
apiKey
name
key
in
query

Compat mode Google API

Compat mode Google API

Translation

Get API version

GET /compatmode/google/apiVersion

Current version for this API

callback: string
in query

Javascript callback function name for JSONP Support

Successful response

400 Bad Request

Invalid parameters

500 Internal Server Error

Error

Response Content-Types: application/json
Response Example (200 OK)
{
  "version": "1.0.0"
}

Translate v2

POST /compatmode/google/language/translate/v2

Translate text from source language to target language

q: string[]
in query

Input text. This parameter can be repeated. 100000 paragraphs / 50 MB maximum per request (please contact SYSTRAN support for more).

Array values passed as multiple parameters: ?q=aaa&q=bbb

source: string auto
in query

Source language code.

When the value is set to auto, the language will be automatically detected, used to enhance the translation, and returned in output.

target: string
in query

Target language code

format: string
in query

Format of the source text.

The format of the source text, in either HTML (default) or plain-text. A value of html indicates HTML and a value of text indicates plain-text.

model: string nmt, base
in query

If the model is nmt, and the requested Translation Resource is not activated and/or not running, the request will be translated using the base model.

If model is not provided, nmt will be requested by default.

nmt will request a profile with size: "M" base will request a profile with size: "S"

200 OK

Successful response

type
object
400 Bad Request

Invalid parameters

500 Internal Server Error

Error

Response Content-Types: application/json
Response Example (200 OK)
{
  "error": {
    "message": "Internal error",
    "statusCode": 500,
    "info": "object"
  }
}

Detect v2

POST /compatmode/google/language/translate/v2/detect

Detects the language of text within a request.

q: string[]
in query

Input text. This parameter can be repeated. 100000 paragraphs / 50 MB maximum per request (please contact SYSTRAN support for more).

Array values passed as multiple parameters: ?q=aaa&q=bbb

200 OK

Successful response

type
object
400 Bad Request

Invalid parameters

500 Internal Server Error

Error

Response Content-Types: application/json
Response Example (200 OK)
{
  "error": {
    "message": "Internal error",
    "statusCode": 500,
    "info": "object"
  }
}

Supported languages

GET /compatmode/google/language/translate/v2/languages

List of target languages in which translation is supported.

This list can be limited to a specific target language.

target: string[]
in query

Language code into which to translate the source text

Array values passed as multiple parameters: ?target=aaa&target=bbb

200 OK

Successful response

type
object
400 Bad Request

Invalid parameters

500 Internal Server Error

Error

Response Content-Types: application/json
Response Example (200 OK)
{
  "error": {
    "message": "Internal error",
    "statusCode": 500,
    "info": "object"
  }
}

Schema Definitions

TranslationData: object

translations: object[]

Outputs of Translations

object
error: string

Error at output level

detectedSourceLanguage: string

Result of the automatic language detection if auto or no source was specified as source language

translatedText: string

Text translated into the target language.

model: string

The translation model used. nmt for the Pure Neural Machine Translation (NMT). base for other model (RBMT, SMT, SPE)

Example
{
  "translations": [
    {
      "error": "Internal error",
      "detectedSourceLanguage": "en",
      "translatedText": "le chien",
      "model": "nmt"
    }
  ]
}

DetectionData: object

detections: object[]

Outputs of Detections

object
error: string

Error at output level

language: string

Result of the automatic language detection if auto or no source was specified as source language

isReliable: boolean

Deprecated Indicates whether the language detection result is reliable. Will be always true

confidence: double

The confidence of the detection result for this language

Example
{
  "detections": [
    {
      "error": "Internal error",
      "language": "en",
      "isReliable": true,
      "confidence": "nmt"
    }
  ]
}

SupportedLanguagesData: object

languages: object[]

Outputs of Languages

object
language: string

Supported target language code

name: string

Not implemented. Should be an human readable name of the language localized to the target language. language will be returned instead.

Example
{
  "languages": [
    {
      "language": "en",
      "name": "en"
    }
  ]
}

TranslationOutput: object

error: string

Error at output level

detectedSourceLanguage: string

Result of the automatic language detection if auto or no source was specified as source language

translatedText: string

Text translated into the target language.

model: string

The translation model used. nmt for the Pure Neural Machine Translation (NMT). base for other model (RBMT, SMT, SPE)

Example
{
  "error": "Internal error",
  "detectedSourceLanguage": "en",
  "translatedText": "le chien",
  "model": "nmt"
}

DetectionOutput: object

error: string

Error at output level

language: string

Result of the automatic language detection if auto or no source was specified as source language

isReliable: boolean

Deprecated Indicates whether the language detection result is reliable. Will be always true

confidence: double

The confidence of the detection result for this language

Example
{
  "error": "Internal error",
  "language": "en",
  "isReliable": true,
  "confidence": "nmt"
}

SupportedLanguagesOutput: object

language: string

Supported target language code

name: string

Not implemented. Should be an human readable name of the language localized to the target language. language will be returned instead.

Example
{
  "language": "en",
  "name": "en"
}

TranslationResponse: object

The response will be a JSON object containing the result of the translation.

  {
    "warning": "", /* Warning at request level */
    "error": {
      "message": "" /* Error at request level */
      "info": {}
    },
    "translations": [
       {
           "warning": "", /* Warning at input level */
           "error": "", /* Error at input level */
           "detectedSourceLanguage": "fr", /* Result of the automatic language detection if selected */
           "model": "nmt", /* The translation model used */
           "translatedText": "translated text 1", /* Translate text */
       },
       {
           "warning": "", /* Warning at input level */
           "error": "", /* Error at input level */
           "model": "nmt", /* The translation model used */
           "translatedText": "translated text 2" /* Translate text */
       }
    ]
  }
error: ErrorResponse

Error at request level

data: object

Data

Example
{
  "error": {
    "message": "Internal error",
    "statusCode": 500,
    "info": "object"
  }
}

DetectionResponse: object

The response will be a JSON object containing the result of the detections.

  {
    "warning": "", /* Warning at request level */
    "error": {
      "message": "" /* Error at request level */
      "info": {}
    },
    "detections": [
       {
           "warning": "", /* Warning at input level */
           "error": "", /* Error at input level */
           "language": "fr", /* Result of the automatic language detection */
           "isReliable": true, /* Deprecated field */
           "confidence": 0.9597339010238647, /* The confidence of the detection */
       },
       {
           "warning": "", /* Warning at input level */
           "error": "", /* Error at input level */
           "language": "en", /* Result of the automatic language detection */
           "isReliable": true, /* Deprecated field */
           "confidence": 0.8263649010258761, /* The confidence of the detection */
       }
    ]
  }
error: ErrorResponse

Error at request level

data: object

Data

Example
{
  "error": {
    "message": "Internal error",
    "statusCode": 500,
    "info": "object"
  }
}

LanguagePair: object

source: string

Source language

target: string

Target language

profiles: Profile

Array of profile identifiers

Profile
Example
{
  "source": "en",
  "target": "fr",
  "profiles": [
    {
      "id": "6b80a3f5-aff2-41ba-a5ce-21603738432e",
      "private": false
    }
  ]
}

SupportedLanguagesResponse: object

error: ErrorResponse

Error at request level

data: object

Data

Example
{
  "error": {
    "message": "Internal error",
    "statusCode": 500,
    "info": "object"
  }
}

Profile: object

Profile

id: string

Profile UUID (Universally Unique IDentifier)

private: boolean

Public or private profile

Example
{
  "id": "6b80a3f5-aff2-41ba-a5ce-21603738432e",
  "private": false
}

ApiVersionResponse: object

version: string
Example
{
  "version": "1.0.0"
}

ErrorResponse: object

message: string

Readable description of the error

statusCode: integer
info: object

Additional information about the error

Example
{
  "message": "Internal error",
  "statusCode": 500,
  "info": "object"
}