Locales

GET /v2/projects/:project_id/locales

List all locales for the given project.

This endpoint is paginated.

Example Request

curl "https://api.phraseapp.com/api/v2/projects/:project_id/locales" \
  -u USERNAME_OR_ACCESS_TOKEN
phraseapp locales list <project_id>

Response

Status: 200
[ { "id": "abcd1234cdef1234abcd1234cdef1234", "name": "de", "code": "de-DE", "default": true, "main": false, "rtl": false, "plural_forms": [ "zero", "one", "other" ], "source_locale": { "id": "abcd1234cdef1234abcd1234cdef1234", "name": "en", "code": "en-GB" }, "created_at": "2015-01-28T09:52:53Z", "updated_at": "2015-01-28T09:52:53Z" }, { "id": "abcd1234cdef1234abcd1234cdef1234", "name": "de", "code": "de-DE", "default": true, "main": false, "rtl": false, "plural_forms": [ "zero", "one", "other" ], "source_locale": { "id": "abcd1234cdef1234abcd1234cdef1234", "name": "en", "code": "en-GB" }, "created_at": "2015-01-28T09:52:53Z", "updated_at": "2015-01-28T09:52:53Z" } ]

GET /v2/projects/:project_id/locales/:id

Get details on a single locale for a given project.

Example Request

curl "https://api.phraseapp.com/api/v2/projects/:project_id/locales/:id" \
  -u USERNAME_OR_ACCESS_TOKEN
phraseapp locale show <project_id> <id>

Response

Status: 200
{ "id": "abcd1234cdef1234abcd1234cdef1234", "name": "de", "code": "de-DE", "default": true, "main": false, "rtl": false, "plural_forms": [ "zero", "one", "other" ], "source_locale": { "id": "abcd1234cdef1234abcd1234cdef1234", "name": "en", "code": "en-GB" }, "created_at": "2015-01-28T09:52:53Z", "updated_at": "2015-01-28T09:52:53Z", "statistics": { "keys_total_count": 2120, "keys_untranslated_count": 100, "words_total_count": 3102102, "translations_completed_count": 1920, "translations_unverified_count": 32, "unverified_words_count": 129, "missing_words_count": 3920 } }

POST /v2/projects/:project_id/locales

Create a new locale.

Parameters

Name Type Description
name string Locale name
code string Locale ISO code
default
optional
boolean Indicates whether locale is the default locale. If set to true, the previous default locale the project is no longer the default locale.
Default: false
main
optional
boolean Indicates whether locale is a main locale.
Default: false
rtl
optional
boolean Indicates whether locale is a RTL (Right-to-Left) locale.
Default: auto-detected
source_locale_id
optional
id Source locale. Can be the name or public id of the locale. Preferred is the public id.
unverify_new_translations
optional
boolean Indicates that new translations for this locale should be marked as unverified.
Default: false
unverify_updated_translations
optional
boolean Indicates that updated translations for this locale should be marked as unverified.
Default: false

Example Request

curl "https://api.phraseapp.com/api/v2/projects/:project_id/locales" \
  -u USERNAME_OR_ACCESS_TOKEN \
  -X POST \
  -d '{"name":"de","code":"de-DE","source_locale_id":"abcd1234abcd1234abcd1234abcd1234"}' \
  -H 'Content-Type: application/json'
phraseapp locale create <project_id> \
--name de \
--code de-DE \
--source-locale-id abcd1234abcd1234abcd1234abcd1234

Response

Status: 201
{ "id": "abcd1234cdef1234abcd1234cdef1234", "name": "de", "code": "de-DE", "default": true, "main": false, "rtl": false, "plural_forms": [ "zero", "one", "other" ], "source_locale": { "id": "abcd1234cdef1234abcd1234cdef1234", "name": "en", "code": "en-GB" }, "created_at": "2015-01-28T09:52:53Z", "updated_at": "2015-01-28T09:52:53Z", "statistics": { "keys_total_count": 2120, "keys_untranslated_count": 100, "words_total_count": 3102102, "translations_completed_count": 1920, "translations_unverified_count": 32, "unverified_words_count": 129, "missing_words_count": 3920 } }

PATCH /v2/projects/:project_id/locales/:id

Update an existing locale.

Parameters

Name Type Description
name string Locale name
code string Locale ISO code
default
optional
boolean Indicates whether locale is the default locale. If set to true, the previous default locale the project is no longer the default locale.
Default: false
main
optional
boolean Indicates whether locale is a main locale.
Default: false
rtl
optional
boolean Indicates whether locale is a RTL (Right-to-Left) locale.
Default: auto-detected
source_locale_id
optional
id Source locale. Can be the name or public id of the locale. Preferred is the public id.
unverify_new_translations
optional
boolean Indicates that new translations for this locale should be marked as unverified.
Default: false
unverify_updated_translations
optional
boolean Indicates that updated translations for this locale should be marked as unverified.
Default: false

Example Request

curl "https://api.phraseapp.com/api/v2/projects/:project_id/locales/:id" \
  -u USERNAME_OR_ACCESS_TOKEN \
  -X PATCH \
  -d '{"name":"de","code":"de-DE","source_locale_id":"abcd1234abcd1234abcd1234abcd1234"}' \
  -H 'Content-Type: application/json'
phraseapp locale update <project_id> <id> \
--name de \
--code de-DE \
--source-locale-id abcd1234abcd1234abcd1234abcd1234

Response

Status: 200
{ "id": "abcd1234cdef1234abcd1234cdef1234", "name": "de", "code": "de-DE", "default": true, "main": false, "rtl": false, "plural_forms": [ "zero", "one", "other" ], "source_locale": { "id": "abcd1234cdef1234abcd1234cdef1234", "name": "en", "code": "en-GB" }, "created_at": "2015-01-28T09:52:53Z", "updated_at": "2015-01-28T09:52:53Z", "statistics": { "keys_total_count": 2120, "keys_untranslated_count": 100, "words_total_count": 3102102, "translations_completed_count": 1920, "translations_unverified_count": 32, "unverified_words_count": 129, "missing_words_count": 3920 } }

DELETE /v2/projects/:project_id/locales/:id

Delete an existing locale.

Example Request

curl "https://api.phraseapp.com/api/v2/projects/:project_id/locales/:id" \
  -u USERNAME_OR_ACCESS_TOKEN \
  -X DELETE
phraseapp locale delete <project_id> <id>

Response

Status: 204

GET /v2/projects/:project_id/locales/:id/download

Download a locale in a specific file format.

Rate limited: This call has a rate limiting applied

Parameters

Name Type Description
file_format string File format name. See the format guide for all supported file formats.
tag
optional
string Limit result to keys tagged with the given tag (identified by its name).
include_empty_translations
optional
boolean Indicates whether keys without translations should be included in the output as well.
Default: false
keep_notranslate_tags
optional
boolean Indicates whether [NOTRANSLATE] tags should be kept.
Default: false
convert_emoji
optional
boolean Indicates whether Emoji symbols should be converted to actual Emojis. Working with Emojis.
Default: false
format_options
optional
hash Additional formatting and render options. See the format guide for a list of options available for each format. Specify format options like this: ...&format_options[foo]=bar
encoding
optional
string Enforces a specific encoding on the file contents. Valid options are "UTF-8", "UTF-16" and "ISO-8859-1".
skip_unverified_translations
optional
boolean Indicates whether the locale file should skip all unverified translations.
Default: false
fallback_locale_id
optional
string If a key has no translation in the locale being downloaded the translation in the fallback locale will be used. Provide the public ID of the locale that should be used as the fallback. Requires include_empty_translations to be set to true.

Example Request

curl "https://api.phraseapp.com/api/v2/projects/:project_id/locales/:id/download?file_format=yml&tag=feature" \
  -u USERNAME_OR_ACCESS_TOKEN
phraseapp locale download <project_id> <id> \
--file-format yml \
--tag feature

Response

Status: 200
--- en: title: a Title page: other_content: Other content