Редактировать проект

Редактирование Crowdin проекта.


POST https://api.crowdin.com/api/project/{идентификатор-проекта}/edit-project?key={ключ-проекта}


Название Значение Описание
name необязательный строка Название проекта.
languages необязательный массив An array of language codes a project should be translate to.
join_policy необязательный строка Project join policy. Acceptable values are:
  • открытый
  • private
language_access_policy optional строка Defines how project members can access target languages. Acceptable values are:
  • "open" - any translator can access any language.
  • "moderate" - translator should be granted with access to certain language.
hide_duplicates необязательный число Defines whether duplicated strings should be displayed to translators or should be hidden and translated automatically. Acceptable values are:
  • 0: Show – translators will translate each instance separately
  • 1: Hide – all duplicates will share the same translation
  • 2: Show, but auto-translate them
  • 3: Show (recommended for versions) — duplicates will be hidden only between versions
export_translated_only optional булево Defines whether only translated strings will be exported to the final file. We do not recommend to set this option if you have text (*.html, *.txt, *.docx etc.) documents in your project since it may damage resulted files. Допустимые значения: 1 или 0.
export_approved_only нео булево If set to 1 only approved translations will be exported in resulted ZIP file. Acceptable values are: 1 or 0.
auto_translate_dialects optional булево Untranslated strings of dialect will be translated automatically in exported file, leveraging translations from main language. Acceptable values are: 1 or 0.
public_downloads необязательный булево Defines whether "Download" button visible to everyone on Crowdin webpages. Acceptable values are: 1 or 0.
use_global_tm необязательный булево Defines if translations would be leveraged from Crowdin Global Translation Memory. When using this option any translations made in your project will be commited to Crowdin Global TM automatically. Допустимые значения: 1 или 0.
logo необязательный файл Project logo at Crowdin.
cname необязательный строка Custom domain name for Crowdin project.
description необязательный строка Описание проекта.
qa_checks optional массив Defines whether the QA checks should be active in the project. As a key you must specify QA check parameter (An Overview of QA Check Parameters). Possible keys are:
  • "enabled" — Enable of disable QA checks
  • "empty" — Empty translation
  • "size" — Length issues
  • "tags" — Tags mismatch
  • "spaces" — Spaces mismatch
  • "variables" — Variables mismatch
  • "punctuation" — Punctuation mismatch
  • "symbol_register" — Character case mismatch
  • "special_symbols" — Special characters mismatch
  • "wrong_translation" — “Incorrect translation” issues
  • "spellcheck" — Spelling
  • "icu" — ICU syntax
Допустимые значения: 1 или 0.
Заметка! This option is available only for organization plans.
webhook_file_translated optional строка Open this URL when one of the project files is translated. URL will be opened with "project" - project identifier, "language" - language code and "file" - file name.
webhook_file_proofread optional строка Open this URL when one of the project files is proofread. URL will be opened with "project" - project identifier, "language" - language code and "file" - file name.
webhook_project_translated optional строка Open this URL when project translation is complete. URL will be opened with "project" - project identifier and "language" - language code.
webhook_project_proofread optional строка Open this URL when project proofreading is complete. URL will be opened with "project" - project identifier and "language" - language code.
json необязательный строка Может не содержать значение. Указывает, что ответ должен быть в формате JSON.
jsonp необязательный строка Callback function name. Defines that response should be in JSONP format.
project-identifier обязательный строка Должен содержать идентификатор проекта.
project-key обязательный строка API-ключ проекта.


If the method is successful, it responds with an XML structure, as it is shown below (when language_access_policy = open).
<?xml version="1.0" encoding="ISO-8859-1"?>
Response example for projects with "Moderate" language_access_policy.
<?xml version="1.0" encoding="ISO-8859-1"?>
Unsuccessful response sample:
<?xml version="1.0" encoding="ISO-8859-1"?>
  <message>API key is not valid</message>


curl \
  -F "logo=@logo.png" \
  -F "name=new project name" \
  -F "description=new project description" \
  -F "cname=new.example.com" \
  -F "languages[]=de" \
  -F "languages[]=fr" \
  -F "languages[]=zh-CN" \
  -F "hide_duplicates=1" \
  -F "export_approved_only=0" \
  -F "public_downloads=1" \
  -F "qa_checks[enabled]=1" \
$post_params = array();
$request_url = 'https://api.crowdin.com/api/project/{project-identifier}/edit-project?key={project-key}';
$post_params['name'] = 'new project name';
$post_params['join_policy'] = 'open';
$post_params['languages[0]'] = 'fr';
$post_params['languages[1]'] = 'de';
$post_params['languages[2]'] = 'zh-CN';
$post_params['qa_checks[enabled]'] = 1;

$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);

echo $result;

Была ли эта статья полезной?