Datei exportieren

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

Anfrage

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

GET https://api.crowdin.com/api/project/{Projektkennung}/export-file?key={Projektschlüssel}
GET https://api.crowdin.com/api/project/{Projekt-ID}/export-file?login={Nutzername}&account-key={Kontoschlüssel}
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.

Parameter

Name Wert Beschreibung
key benötigt String Projekt-API-Schlüssel
project-identifier benötigt String Sollte die Projekt-ID enthalten.
file benötigt String This parameter specifies a path to the file that should be exported from the project.
language benötigt String Crowdin-Sprachcodes.
branch optional String Der Name des dazugehörigen Versionszweigs (Versionsverwaltung).
format optional String Specify xliff to export file in the XLIFF file format.
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. Zulässige Werte sind: „0” und „1”.
export_translated_files_only optional Bool. Use this parameter if you want to get only translated files on export. Zulässige Werte sind: „0” und „1”.
export_approved_only optional Bool. If set to 1 only approved translations will be exported in resulted file. Zulässige Werte sind: „0” und „1”.

Beispiele

#Datei im Quelldateiformat herunterladen
wget -O de.xml "https://api.crowdin.com/api/project/{Projekt-ID}/export-file?file=en.xml&language=de&key={Projektschlüssel}"

#Datei für die Offline-Übersetzung im XLIFF-Format herunterladen
wget -O de.xliff "https://api.crowdin.com/api/project/{Projekt-ID}/export-file?file=en.html&format=xliff&language=de&key={Projektschlüssel}"
<?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&key={project-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;

War dieser Artikel hilfreich?