Tools - Translate strings

This method lets you pre-translate strings from translation memories. It does not require a project to be used.

This method is work in progress and not yet released

URL

(POST) /api/apps/tools/strings/tmtranslate

PARAMETERS

The request BODY contains a JSON object with these properties:

src

The source locale.

string, Mandatory

trg

The target locale.

string, Mandatory

rids

An array of resources to be used for pre-translation. These can be translation memories, project memories or terminology databases. The order in which the resources defines their priority.

"rids": [ 1000, 2342, 223 ]

You can find resources using resources/list . You can fetch all resources attached to a specific project using: apps/tools/translatefiles/presets/project/{pid} . And there are other APIs available.

string[], Mandatory

sim

The minimum similarity a hit must have to be used for pre-translation. Use 100 for identical hits only. 100 is the default.

int, Optional

strings

The list of strings to translate. Each string has these properties:

  • id: Optional numeric identifier of the string. E.g. use a sequential number.

  • txt: The source text of the string. It must not be null or empty.

  • key: Optional string ID.

object[], Mandatory

A payload may look like:

{ "src": "en", "trg": "fr", "rids": [ 6134, 329 ], "sim": 100, "strings": [ { "id": 100, "txt": "Key events of the period and upcoming news flow" }, { "id": 200, "txt": "We announce the launch of a collaboration." }, { "id": 300, "txt": "Solid tumor tissue" } ] }

 

RESULTS

The method executes synchronously and returns the translated strings in an array. Each array element has these properties:

id

The original string id included in the payload. 0 if it was not specified.

int

txt

The translated source text. Null if no pre-translation was found

string?

sim

The similarity of the pre-translation (90, 100, 110…). Null if not pre-translated.

int?

rid

The resource from which the pre-translation was leveraged. Null if not pre-translated.

int?

key

The optional string’s key if included in the payload.

string?

An example could be:

 

PRE-TRANSLATION MECHANISMS

The pre-translation works the same way as in a project. It takes into consideration the resource settings such as for strict languages, markup penalties, etc. Make sure to choose resources where the languages do match up.

Other characteristics:

  • Markup in the source strings must comply with Wordbee Translator conventions. A markup such as <span/> must be encoded as \x0001 + “span/” + \x0002.

  • Markup of a hit is automatically fixed to adapt to the markup in the source strings.

 

 

Copyright Wordbee - Buzzin' Outside the Box since 2008