Editar Projeto

Editar o projeto Crowdin.

Pedido

Note: Use the combination of project identifier, username, and account key to pass to this endpoint.

POST https://api.crowdin.com/api/project/{project-identifier}/edit-project?login={username}&account-key={account-key}

Parâmetros

Nome Valor Descrição
name opcional string Nome do projeto.
languages opcional array Um array de códigos de idioma um projeto deve ser traduzido para.
join_policy opcional string Project join policy. Os valores aceitáveis são:
  • abrir
  • privado
language_access_policy optional string Defines how project members can access target languages. Os valores aceitáveis são:
  • "open" - qualquer tradutor pode acessar qualquer idioma.
  • "moderate" - translator should be granted with access to certain language.
hide_duplicates optional int Defines whether duplicated strings should be displayed to translators or should be hidden and translated automatically. Os valores aceitáveis são:
  • 0: Mostrar – os tradutores irão, separadamente, traduzir cada instância
  • 1: Escondido – todos os duplicados compartilharão a mesma tradução
  • 2: Mostrar, mas auto-traduzi-los
  • 3: Mostrar (recomendado para versões) — os duplicados serão ocultados apenas entre as versões
export_translated_only optional bool 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. Os valores aceitáveis são: 1 ou 0.
export_approved_only optional bool If set to 1 only approved translations will be exported in resulted ZIP file. Os valores aceitáveis são: 1 ou 0.
auto_translate_dialects optional bool Untranslated strings of dialect will be translated automatically in exported file, leveraging translations from main language. Os valores aceitáveis são: 1 ou 0.
public_downloads optional bool Defines whether "Download" button visible to everyone on Crowdin webpages. Os valores aceitáveis são: 1 ou 0.
use_global_tm optional bool 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. Os valores aceitáveis são: 1 ou 0.
logo optional ficheiro Project logo at Crowdin.
cname optional string Custom domain name for Crowdin project.
description optional string Project description.
qa_checks optional array 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
Os valores aceitáveis são: 1 ou 0.
Note! This option is available only for organization plans.
webhook_file_translated optional string 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 string 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 string Open this URL when project translation is complete. URL will be opened with "project" - project identifier and "language" - language code.
webhook_project_proofread optional string Open this URL when project proofreading is complete. URL will be opened with "project" - project identifier and "language" - language code.
json opcional string Pode não conter valor. Define que a resposta deve estar no formato JSON.
jsonp opcional string Nome da função de retorno de chamada. Define que a resposta deve estar no formato JSONP.
Variáveis
project-identifier string Identificador do projeto.
login string O teu nome de utilizador no Crowdin.
account-key string A tua chave API de conta.

Resposta

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="UTF-8"?>
<project>
  <success>1</success>
  <invitation>http://translate.example.com/project/test-project-api/invite</invitation>
  <url>http://translate.example.com/project/test-project-api</url>
</project>
Response example for projects with "Moderate" language_access_policy.
<?xml version="1.0" encoding="UTF-8"?>
<project>
  <success>1</success>
  <invitation>
    <item>
      <language>Ucraniano</language>
      <translator>http://translate.example.com/project/test-project-api/invite?d=7585662585d5d32307d3937373</translator>
      <proofreader>http://translate.example.com/project/test-project-api/invite?d=3585k635r4d5d32307d3937373</proofreader>
    </item>
  </invitation>
  <url>https://crowdin.com/project/test-project-api</url>
</project>
Unsuccessful response sample:
<?xml version="1.0" encoding="UTF-8"?>
<error>
  <code>3</code>
  <message>A chave API não é válida</message>
</error>

Exemplos

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" \
  https://api.crowdin.com/api/project/{project-identifier}/edit-project?login={username}&account-key={account-key}
<?php
$post_params = array();
$request_url = 'https://api.crowdin.com/api/project/{project-identifier}/edit-project?login={username}&account-key={account-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);
curl_close($ch);

echo $result;

Este artigo foi útil?