Please consider that API 2.0 is now the preferred version to be used. The old API will remain fully functional until the end of 2021.
Pre-translate Crowdin project files.
Name | Value | Description |
---|---|---|
languages required | array | Set of languages to which pre-translation should be applied. For this use Сrowdin language codes. |
files required | array | Files array that should be translated. Array keys should contain file names with path in Crowdin project. |
method optional | string | Defines which method will be used for pre-translation. Acceptable values are:
|
engine optional | string | Defines engine for Machine Translation. Acceptable values are:
|
approve_translated optional | bool | Automatically approves translated strings. Acceptable values are: 1 or 0. It works only with TM pre-translation method. |
auto_approve_option optional | int | Defines which translations added by pre-translation via TM should be auto-approved. Acceptable values are 0, 1, or 2. The default value is 0.
|
import_duplicates optional | bool | Adds translations even if the same translation already exists. Acceptable values are: 1 or 0. It works only with TM pre-translation method. |
apply_untranslated_strings_only optional | bool | Applies translations for untranslated strings only. Acceptable values are: 1 or 0. It works only with TM pre-translation method. |
perfect_match optional | bool | Pre-translate will be applied only for those strings, that have absolute match in source text and contextual information. Acceptable values are: 1 or 0. It works only with TM pre-translation method. |
json optional | string | May not contain value. Defines that response should be in JSON format. |
jsonp optional | string | Callback function name. Defines that response should be in JSONP format. |
Variables | ||
project-identifier | string | Project identifier. |
login | string | Your username in Crowdin. |
account-key | string | Your account API key. |
<?xml version="1.0" encoding="UTF-8"?>
<success>
</success>
<?xml version="1.0" encoding="UTF-8"?>
<success>
<languages>
<language status="skipped">French</language>
</languages>
</success>
<?xml version="1.0" encoding="UTF-8"?>
<error>
<code>3</code>
<message>API key is not valid</message>
</error>
curl \
-F "languages[]=fr" \
-F "languages[]=uk" \
-F "files[]=/example.txt" \
https://api.crowdin.com/api/project/{project-identifier}/pre-translate?login={username}&account-key={account-key}
<?php
$post_params = array();
$request_url = 'https://api.crowdin.com/api/project/{project-identifier}/pre-translate?login={username}&account-key={account-key}';
$post_params['languages[]'] = 'uk';
$post_params['files[]'] = '/example.txt';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_params);
$result = curl_exec($ch);
curl_close($ch);
echo $result;