Tilpasset MT-modul (Maskinoversættelse)

This module helps you connect machine translation engines not yet supported by Crowdin. Når denne form for app er oprettet, vil man kunne præoversætte sit indhold med den tilsluttede MT eller aktivere oversættelsesforslag herfra til at blive vist i Redigeringsværktøjet for oversættere.

You can grant access to this module to one of the following user categories:

For Crowdin:

  • Only me (i.e., project owner)
  • All project members
  • Selected users

For Crowdin Enterprise:

  • Only organization admins
  • All users in the organization projects
  • Selected users

Structure

{
   "custom-mt": [
     {
            "key": "custom-mt",
            "name": "Custom MT",
            "logo": "/logo.png",
            "url": "/translate",
            "withContext": true,
            "batchSize": 10
      }
    ]
}

Egenskaber

key

Type: string

Required: yes

Description: Module identifier within the Crowdin app.

name

Type: string

Required: yes

Description: The human-readable name of the module.

logo

Type: string

Required: yes

Description: The relative URL to the custom MT's logo that will be displayed in the Crowdin UI.
The recommended resolution is 48x48 pixels.

url

Type: string

Required: yes

Description: The relative URL to the content page of the module that will be integrated with Crowdin.

withContext

Type: boolean

Required: no

Description: The additional meta data that will be sent along the strings.

batchSize

Type: integer

Required: no

Description: The maximum quantity of strings that can be sent to the Custom MT app in one request.

environments

Type: string

Allowed values: crowdin, crowdin-enterprise

Description: Set of environments where a module could be installed.
This parameter is needed for cross-product applications.

Communication between Custom MT App and Crowdin

The system sends texts for translation using url and then the app processes the texts and responds back to the system with one of the two possible types of responses: without errors, and with errors.

HTTP request:

https://{AppBaseUrl}/translate/?source=en&target=uk&project_id=727186&jwtToken={yourTokenValue}

Request Headers

The request to translate will contain authorization headers (e.g., Authorization: Bearer <App JWT token>).

Query parameters

source

Type: string

Description: Source language.

target

Type: string

Description: Target language.

project_id

Type: integer

Description: The numeric identifier of a Crowdin project.

strings

Type: string

Description: Source strings that require translation.

Request to the App from Crowdin for applicationUrl (simple)

Request payload example:

{
   "strings":[
      "Save as...",
      "New file",
      "You received one message.",
      "You received {number} messages."
   ]
}

Request to the App from Crowdin for applicationUrl (extended)

To use the extended request please add the withContext parameter to your Custom MT module.

Request payload example:

{
   "strings":[
      {
         "id":1,
         "projectId":727186,
         "fileId":47047,
         "text":"Save as...",
         "identifier":"save_as",
         "context":"translation Context",
         "maxLength":15,
         "isHidden":false,
         "isPlural":false,
         "pluralForm":null
      },
      {
         "id":2,
         "projectId":727186,
         "fileId":47047,
         "text":"New file",
         "identifier":"new_file",
         "context":"translation Context",
         "maxLength":null,
         "isHidden":false,
         "isPlural":false,
         "pluralForm":null
      },
      {
         "id":3,
         "projectId":727186,
         "fileId":47047,
         "text":"You received one new message.",
         "identifier":"new_message",
         "context":"translation Context",
         "maxLength":null,
         "isHidden":false,
         "isPlural":true,
         "pluralForm":"one"
      },
      {
         "id":3,
         "projectId":727186,
         "fileId":47047,
         "text":"You received {number} new messages.",
         "identifier":"new_message",
         "context":"translation Context",
         "maxLength":null,
         "isHidden":false,
         "isPlural":true,
         "pluralForm":"other"
      }
   ]
}

Expected Response from the App (Without errors)

Response payload example:

{
   "data":{
      "translations":[
         "Зберегти як...",
         "Новий файл",
         "Ви отримали одне нове повідомлення.",
         "Ви отримали {number} нових повідомлень."
      ]
   }
}

Expected Response from the App (With errors)

Response payload example:

{
   "error":{
      "message":"Error message from the App or MT engine"
   }
}

The structure of the responses from the app should correspond to the presented examples, otherwise Crowdin will consider them invalid.

Var denne artikel nyttig?