curl "https://api.phrase.com/v2/projects/:project_id/locales/:locale_id/downloads" \
-u USERNAME_OR_ACCESS_TOKEN \
-X POST \
-d '{"branch":"my-feature-branch","file_format":"yml","tags":"feature1,feature","custom_metadata_filters":{"tone":"friendly"}}' \
-H 'Content-Type: application/json'phrase locale_downloads create \
--project_id <project_id> \
--locale_id <locale_id> \
--branch my-feature-branch \
--file_format yml \
--tags feature1,feature2 \
--access_token <token>import requests
url = "https://api.phrase.com/v2/projects/{project_id}/locales/{locale_id}/downloads"
payload = {
"file_format": "yml",
"branch": "my-feature-branch",
"tags": "feature1,feature2",
"include_empty_translations": True,
"exclude_empty_zero_forms": True,
"include_translated_keys": True,
"keep_notranslate_tags": True,
"format_options": { "format_options": { "foo": "bar" } },
"encoding": "UTF-8",
"include_unverified_translations": True,
"use_last_reviewed_version": None,
"locale_ids": ["de", "en"],
"fallback_locale_id": "abcd1234abcd1234abcd1234abcd1234",
"use_locale_fallback": False,
"fallback_for_unverified_translations": False,
"source_locale_id": "abcd1234abcd1234abcd1234abcd1234",
"custom_metadata_filters": {},
"translation_key_prefix": "prefix_",
"filter_by_prefix": True,
"updated_since": "2023-01-01T00:00:00Z"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
file_format: 'yml',
branch: 'my-feature-branch',
tags: 'feature1,feature2',
include_empty_translations: true,
exclude_empty_zero_forms: true,
include_translated_keys: true,
keep_notranslate_tags: true,
format_options: {format_options: {foo: 'bar'}},
encoding: 'UTF-8',
include_unverified_translations: true,
use_last_reviewed_version: null,
locale_ids: ['de', 'en'],
fallback_locale_id: 'abcd1234abcd1234abcd1234abcd1234',
use_locale_fallback: false,
fallback_for_unverified_translations: false,
source_locale_id: 'abcd1234abcd1234abcd1234abcd1234',
custom_metadata_filters: {},
translation_key_prefix: 'prefix_',
filter_by_prefix: true,
updated_since: '2023-01-01T00:00:00Z'
})
};
fetch('https://api.phrase.com/v2/projects/{project_id}/locales/{locale_id}/downloads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.phrase.com/v2/projects/{project_id}/locales/{locale_id}/downloads",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'file_format' => 'yml',
'branch' => 'my-feature-branch',
'tags' => 'feature1,feature2',
'include_empty_translations' => true,
'exclude_empty_zero_forms' => true,
'include_translated_keys' => true,
'keep_notranslate_tags' => true,
'format_options' => [
'format_options' => [
'foo' => 'bar'
]
],
'encoding' => 'UTF-8',
'include_unverified_translations' => true,
'use_last_reviewed_version' => null,
'locale_ids' => [
'de',
'en'
],
'fallback_locale_id' => 'abcd1234abcd1234abcd1234abcd1234',
'use_locale_fallback' => false,
'fallback_for_unverified_translations' => false,
'source_locale_id' => 'abcd1234abcd1234abcd1234abcd1234',
'custom_metadata_filters' => [
],
'translation_key_prefix' => 'prefix_',
'filter_by_prefix' => true,
'updated_since' => '2023-01-01T00:00:00Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.phrase.com/v2/projects/{project_id}/locales/{locale_id}/downloads"
payload := strings.NewReader("{\n \"file_format\": \"yml\",\n \"branch\": \"my-feature-branch\",\n \"tags\": \"feature1,feature2\",\n \"include_empty_translations\": true,\n \"exclude_empty_zero_forms\": true,\n \"include_translated_keys\": true,\n \"keep_notranslate_tags\": true,\n \"format_options\": {\n \"format_options\": {\n \"foo\": \"bar\"\n }\n },\n \"encoding\": \"UTF-8\",\n \"include_unverified_translations\": true,\n \"use_last_reviewed_version\": null,\n \"locale_ids\": [\n \"de\",\n \"en\"\n ],\n \"fallback_locale_id\": \"abcd1234abcd1234abcd1234abcd1234\",\n \"use_locale_fallback\": false,\n \"fallback_for_unverified_translations\": false,\n \"source_locale_id\": \"abcd1234abcd1234abcd1234abcd1234\",\n \"custom_metadata_filters\": {},\n \"translation_key_prefix\": \"prefix_\",\n \"filter_by_prefix\": true,\n \"updated_since\": \"2023-01-01T00:00:00Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.phrase.com/v2/projects/{project_id}/locales/{locale_id}/downloads")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"file_format\": \"yml\",\n \"branch\": \"my-feature-branch\",\n \"tags\": \"feature1,feature2\",\n \"include_empty_translations\": true,\n \"exclude_empty_zero_forms\": true,\n \"include_translated_keys\": true,\n \"keep_notranslate_tags\": true,\n \"format_options\": {\n \"format_options\": {\n \"foo\": \"bar\"\n }\n },\n \"encoding\": \"UTF-8\",\n \"include_unverified_translations\": true,\n \"use_last_reviewed_version\": null,\n \"locale_ids\": [\n \"de\",\n \"en\"\n ],\n \"fallback_locale_id\": \"abcd1234abcd1234abcd1234abcd1234\",\n \"use_locale_fallback\": false,\n \"fallback_for_unverified_translations\": false,\n \"source_locale_id\": \"abcd1234abcd1234abcd1234abcd1234\",\n \"custom_metadata_filters\": {},\n \"translation_key_prefix\": \"prefix_\",\n \"filter_by_prefix\": true,\n \"updated_since\": \"2023-01-01T00:00:00Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.phrase.com/v2/projects/{project_id}/locales/{locale_id}/downloads")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"file_format\": \"yml\",\n \"branch\": \"my-feature-branch\",\n \"tags\": \"feature1,feature2\",\n \"include_empty_translations\": true,\n \"exclude_empty_zero_forms\": true,\n \"include_translated_keys\": true,\n \"keep_notranslate_tags\": true,\n \"format_options\": {\n \"format_options\": {\n \"foo\": \"bar\"\n }\n },\n \"encoding\": \"UTF-8\",\n \"include_unverified_translations\": true,\n \"use_last_reviewed_version\": null,\n \"locale_ids\": [\n \"de\",\n \"en\"\n ],\n \"fallback_locale_id\": \"abcd1234abcd1234abcd1234abcd1234\",\n \"use_locale_fallback\": false,\n \"fallback_for_unverified_translations\": false,\n \"source_locale_id\": \"abcd1234abcd1234abcd1234abcd1234\",\n \"custom_metadata_filters\": {},\n \"translation_key_prefix\": \"prefix_\",\n \"filter_by_prefix\": true,\n \"updated_since\": \"2023-01-01T00:00:00Z\"\n}"
response = http.request(request)
puts response.read_body{
"id": "abcd1234cdef1234abcd1234cdef1234",
"status": "completed",
"result": {
"url": "https://example.com/locales/abcd1234cdef1234abcd1234cdef1234/download?file_format=yml"
},
"params": {
"file_format": "yml",
"locale_id": "abcd1234cdef1234abcd1234cdef1234",
"tags": "feature1,feature2",
"branch": "my-feature-branch",
"include_empty_translations": true,
"include_translated_keys": true,
"include_unverified_translations": true
},
"created_at": "2015-01-28T09:52:53Z",
"completed_at": "2015-01-28T09:52:53Z"
}{
"message": "Validation Failed",
"errors": [
{
"resource": "Resource",
"field": "name",
"message": "can't be blank"
}
]
}Initiate async download of a locale
Prepare a locale for download in a specific file format.
curl "https://api.phrase.com/v2/projects/:project_id/locales/:locale_id/downloads" \
-u USERNAME_OR_ACCESS_TOKEN \
-X POST \
-d '{"branch":"my-feature-branch","file_format":"yml","tags":"feature1,feature","custom_metadata_filters":{"tone":"friendly"}}' \
-H 'Content-Type: application/json'phrase locale_downloads create \
--project_id <project_id> \
--locale_id <locale_id> \
--branch my-feature-branch \
--file_format yml \
--tags feature1,feature2 \
--access_token <token>import requests
url = "https://api.phrase.com/v2/projects/{project_id}/locales/{locale_id}/downloads"
payload = {
"file_format": "yml",
"branch": "my-feature-branch",
"tags": "feature1,feature2",
"include_empty_translations": True,
"exclude_empty_zero_forms": True,
"include_translated_keys": True,
"keep_notranslate_tags": True,
"format_options": { "format_options": { "foo": "bar" } },
"encoding": "UTF-8",
"include_unverified_translations": True,
"use_last_reviewed_version": None,
"locale_ids": ["de", "en"],
"fallback_locale_id": "abcd1234abcd1234abcd1234abcd1234",
"use_locale_fallback": False,
"fallback_for_unverified_translations": False,
"source_locale_id": "abcd1234abcd1234abcd1234abcd1234",
"custom_metadata_filters": {},
"translation_key_prefix": "prefix_",
"filter_by_prefix": True,
"updated_since": "2023-01-01T00:00:00Z"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
file_format: 'yml',
branch: 'my-feature-branch',
tags: 'feature1,feature2',
include_empty_translations: true,
exclude_empty_zero_forms: true,
include_translated_keys: true,
keep_notranslate_tags: true,
format_options: {format_options: {foo: 'bar'}},
encoding: 'UTF-8',
include_unverified_translations: true,
use_last_reviewed_version: null,
locale_ids: ['de', 'en'],
fallback_locale_id: 'abcd1234abcd1234abcd1234abcd1234',
use_locale_fallback: false,
fallback_for_unverified_translations: false,
source_locale_id: 'abcd1234abcd1234abcd1234abcd1234',
custom_metadata_filters: {},
translation_key_prefix: 'prefix_',
filter_by_prefix: true,
updated_since: '2023-01-01T00:00:00Z'
})
};
fetch('https://api.phrase.com/v2/projects/{project_id}/locales/{locale_id}/downloads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.phrase.com/v2/projects/{project_id}/locales/{locale_id}/downloads",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'file_format' => 'yml',
'branch' => 'my-feature-branch',
'tags' => 'feature1,feature2',
'include_empty_translations' => true,
'exclude_empty_zero_forms' => true,
'include_translated_keys' => true,
'keep_notranslate_tags' => true,
'format_options' => [
'format_options' => [
'foo' => 'bar'
]
],
'encoding' => 'UTF-8',
'include_unverified_translations' => true,
'use_last_reviewed_version' => null,
'locale_ids' => [
'de',
'en'
],
'fallback_locale_id' => 'abcd1234abcd1234abcd1234abcd1234',
'use_locale_fallback' => false,
'fallback_for_unverified_translations' => false,
'source_locale_id' => 'abcd1234abcd1234abcd1234abcd1234',
'custom_metadata_filters' => [
],
'translation_key_prefix' => 'prefix_',
'filter_by_prefix' => true,
'updated_since' => '2023-01-01T00:00:00Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.phrase.com/v2/projects/{project_id}/locales/{locale_id}/downloads"
payload := strings.NewReader("{\n \"file_format\": \"yml\",\n \"branch\": \"my-feature-branch\",\n \"tags\": \"feature1,feature2\",\n \"include_empty_translations\": true,\n \"exclude_empty_zero_forms\": true,\n \"include_translated_keys\": true,\n \"keep_notranslate_tags\": true,\n \"format_options\": {\n \"format_options\": {\n \"foo\": \"bar\"\n }\n },\n \"encoding\": \"UTF-8\",\n \"include_unverified_translations\": true,\n \"use_last_reviewed_version\": null,\n \"locale_ids\": [\n \"de\",\n \"en\"\n ],\n \"fallback_locale_id\": \"abcd1234abcd1234abcd1234abcd1234\",\n \"use_locale_fallback\": false,\n \"fallback_for_unverified_translations\": false,\n \"source_locale_id\": \"abcd1234abcd1234abcd1234abcd1234\",\n \"custom_metadata_filters\": {},\n \"translation_key_prefix\": \"prefix_\",\n \"filter_by_prefix\": true,\n \"updated_since\": \"2023-01-01T00:00:00Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.phrase.com/v2/projects/{project_id}/locales/{locale_id}/downloads")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"file_format\": \"yml\",\n \"branch\": \"my-feature-branch\",\n \"tags\": \"feature1,feature2\",\n \"include_empty_translations\": true,\n \"exclude_empty_zero_forms\": true,\n \"include_translated_keys\": true,\n \"keep_notranslate_tags\": true,\n \"format_options\": {\n \"format_options\": {\n \"foo\": \"bar\"\n }\n },\n \"encoding\": \"UTF-8\",\n \"include_unverified_translations\": true,\n \"use_last_reviewed_version\": null,\n \"locale_ids\": [\n \"de\",\n \"en\"\n ],\n \"fallback_locale_id\": \"abcd1234abcd1234abcd1234abcd1234\",\n \"use_locale_fallback\": false,\n \"fallback_for_unverified_translations\": false,\n \"source_locale_id\": \"abcd1234abcd1234abcd1234abcd1234\",\n \"custom_metadata_filters\": {},\n \"translation_key_prefix\": \"prefix_\",\n \"filter_by_prefix\": true,\n \"updated_since\": \"2023-01-01T00:00:00Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.phrase.com/v2/projects/{project_id}/locales/{locale_id}/downloads")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"file_format\": \"yml\",\n \"branch\": \"my-feature-branch\",\n \"tags\": \"feature1,feature2\",\n \"include_empty_translations\": true,\n \"exclude_empty_zero_forms\": true,\n \"include_translated_keys\": true,\n \"keep_notranslate_tags\": true,\n \"format_options\": {\n \"format_options\": {\n \"foo\": \"bar\"\n }\n },\n \"encoding\": \"UTF-8\",\n \"include_unverified_translations\": true,\n \"use_last_reviewed_version\": null,\n \"locale_ids\": [\n \"de\",\n \"en\"\n ],\n \"fallback_locale_id\": \"abcd1234abcd1234abcd1234abcd1234\",\n \"use_locale_fallback\": false,\n \"fallback_for_unverified_translations\": false,\n \"source_locale_id\": \"abcd1234abcd1234abcd1234abcd1234\",\n \"custom_metadata_filters\": {},\n \"translation_key_prefix\": \"prefix_\",\n \"filter_by_prefix\": true,\n \"updated_since\": \"2023-01-01T00:00:00Z\"\n}"
response = http.request(request)
puts response.read_body{
"id": "abcd1234cdef1234abcd1234cdef1234",
"status": "completed",
"result": {
"url": "https://example.com/locales/abcd1234cdef1234abcd1234cdef1234/download?file_format=yml"
},
"params": {
"file_format": "yml",
"locale_id": "abcd1234cdef1234abcd1234cdef1234",
"tags": "feature1,feature2",
"branch": "my-feature-branch",
"include_empty_translations": true,
"include_translated_keys": true,
"include_unverified_translations": true
},
"created_at": "2015-01-28T09:52:53Z",
"completed_at": "2015-01-28T09:52:53Z"
}{
"message": "Validation Failed",
"errors": [
{
"resource": "Resource",
"field": "name",
"message": "can't be blank"
}
]
}Headers
Last modified condition, see Conditional GET requests / HTTP Caching (optional)
ETag condition, see Conditional GET requests / HTTP Caching (optional)
Body
File format name. See the format guide for all supported file formats.
"yml"
Additional formatting and render options. See the format guide
for a list of options available for each format. Pass format options as a JSON object with key-value pairs corresponding
to the option name and value. For example, to include comments in a Gettext file, pass {"include_comments": true}.
{ "format_options": { "foo": "bar" } }
If a key has no translation in the locale being downloaded, the translation in the fallback locale will be used.
Provide the ID of the locale that should be used as the fallback.
Requires include_empty_translations to be set to true unless fallback_for_unverified_translations is also set to true. Mutually exclusive with use_locale_fallback.
"abcd1234abcd1234abcd1234abcd1234"
If a key has no translation in the locale being downloaded, the translation in the fallback locale will be used.
Fallback locale is defined in locale's settings.
Requires include_empty_translations to be set to true unless fallback_for_unverified_translations is also set to true. Mutually exclusive with fallback_locale_id.
false
If set to true, translations in a non-final state are replaced by the fallback locale's translation at export time.
In the simple workflow, "non-final" means unverified. In the review workflow, it additionally includes translated (awaiting review).
No stored translations are modified. Requires fallback_locale_id or use_locale_fallback to be set; a 422 validation error is returned otherwise.
false
Response
Created
Was this page helpful?