Exportar Ficheiro

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.

Crowdin API v2
This method exports single translated files from Crowdin. Additionally, it can be applied to export XLIFF files for offline localization.

Pedido

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

GET https://api.crowdin.com/api/project/{project-identifier}/export-file?login={username}&account-key={account-key}
Note: Exporting files from Crowdin you’ll receive an Etag identifier in response header. Store this identifier so you can use it next time exporting files. Add Etag identifier to the If-None-Match request header to see whether any changes were applied to the file. In case the file was changed it would be downloaded. If not you’ll receive a 304 (Not Modified) status code.

Parâmetros

Nome Valor Descrição
campo obrigatório string Este parâmetro especifica o caminho para o ficheiro que deve ser exportado do projeto.
idioma obrigatório string Código de idioma do Crowdin.
branch opcional string O nome da ramificação da versão relacionada (Gestão de Versões).
format optional string Especifica xliff para exportar o ficheiro no formato de ficheiro XLIFF.
export_translated_only optional bool Use this parameter if you want to get only translated strings in the exported file. We don't 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_translated_files_only optional bool Use this parameter if you want to get only translated files on export. 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 file. Os valores aceitáveis são: 1 ou 0.
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.

Exemplos

#Download file in the same file format as source
wget -O de.xml "https://api.crowdin.com/api/project/{project-identifier}/export-file?file=en.xml&language=de&login={username}&account-key={account-key}"

#Download file for offline translation in XLIFF file format
wget -O de.xliff "https://api.crowdin.com/api/project/{project-identifier}/export-file?file=en.html&format=xliff&language=de&login={username}&account-key={account-key}"
<?php
ini_set('default_socket_timeout', 5); // socket timeout, just in case

$request_url = 'https://api.crowdin.com/api/project/{project-identifier}/export-file?file=en.html&format=xliff&language=de&login={username}&account-key={account-key}';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$result = curl_exec($ch);
curl_close($ch);

echo $result;

Este artigo foi útil?