All URIs are relative to https://api.phrase.com/v2
Method | HTTP request | Description |
---|---|---|
localeCreate | POST /projects/{project_id}/locales | Create a locale |
localeDelete | DELETE /projects/{project_id}/locales/{id} | Delete a locale |
localeDownload | GET /projects/{project_id}/locales/{id}/download | Download a locale |
localeShow | GET /projects/{project_id}/locales/{id} | Get a single locale |
localeUpdate | PATCH /projects/{project_id}/locales/{id} | Update a locale |
localesList | GET /projects/{project_id}/locales | List locales |
LocaleDetails localeCreate(projectId, localeCreateParameters, xPhraseAppOTP)
Create a locale
Create a new locale.
// Import classes:
import com.phrase.client.ApiClient;
import com.phrase.client.ApiException;
import com.phrase.client.Configuration;
import com.phrase.client.auth.*;
import com.phrase.client.models.*;
import com.phrase.client.api.LocalesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.phrase.com/v2");
// Configure HTTP basic authorization: Basic
HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic");
Basic.setUsername("YOUR USERNAME");
Basic.setPassword("YOUR PASSWORD");
// Configure API key authorization: Token
ApiKeyAuth Token = (ApiKeyAuth) defaultClient.getAuthentication("Token");
Token.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Token.setApiKeyPrefix("Token");
LocalesApi apiInstance = new LocalesApi(defaultClient);
String projectId = "projectId_example"; // String | Project ID
LocaleCreateParameters localeCreateParameters = new LocaleCreateParameters(); // LocaleCreateParameters |
String xPhraseAppOTP = "xPhraseAppOTP_example"; // String | Two-Factor-Authentication token (optional)
try {
LocaleDetails result = apiInstance.localeCreate(projectId, localeCreateParameters, xPhraseAppOTP);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling LocalesApi#localeCreate");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
projectId | String | Project ID | |
localeCreateParameters | LocaleCreateParameters | ||
xPhraseAppOTP | String | Two-Factor-Authentication token (optional) | [optional] |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
201 | Created | * X-Rate-Limit-Limit - * X-Rate-Limit-Remaining - * X-Rate-Limit-Reset - |
400 | Bad request | * X-Rate-Limit-Limit - * X-Rate-Limit-Remaining - * X-Rate-Limit-Reset - |
404 | Not Found | * X-Rate-Limit-Limit - * X-Rate-Limit-Remaining - * X-Rate-Limit-Reset - |
429 | Rate Limiting | * X-Rate-Limit-Limit - * X-Rate-Limit-Remaining - * X-Rate-Limit-Reset - |
localeDelete(projectId, id, xPhraseAppOTP, branch)
Delete a locale
Delete an existing locale.
// Import classes:
import com.phrase.client.ApiClient;
import com.phrase.client.ApiException;
import com.phrase.client.Configuration;
import com.phrase.client.auth.*;
import com.phrase.client.models.*;
import com.phrase.client.api.LocalesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.phrase.com/v2");
// Configure HTTP basic authorization: Basic
HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic");
Basic.setUsername("YOUR USERNAME");
Basic.setPassword("YOUR PASSWORD");
// Configure API key authorization: Token
ApiKeyAuth Token = (ApiKeyAuth) defaultClient.getAuthentication("Token");
Token.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Token.setApiKeyPrefix("Token");
LocalesApi apiInstance = new LocalesApi(defaultClient);
String projectId = "projectId_example"; // String | Project ID
String id = "id_example"; // String | ID
String xPhraseAppOTP = "xPhraseAppOTP_example"; // String | Two-Factor-Authentication token (optional)
String branch = my-feature-branch; // String | specify the branch to use
try {
apiInstance.localeDelete(projectId, id, xPhraseAppOTP, branch);
} catch (ApiException e) {
System.err.println("Exception when calling LocalesApi#localeDelete");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
projectId | String | Project ID | |
id | String | ID | |
xPhraseAppOTP | String | Two-Factor-Authentication token (optional) | [optional] |
branch | String | specify the branch to use | [optional] |
null (empty response body)
- Content-Type: Not defined
- Accept: Not defined
Status code | Description | Response headers |
---|---|---|
204 | The resource was deleted successfully. | * X-Rate-Limit-Limit - * X-Rate-Limit-Remaining - * X-Rate-Limit-Reset - |
400 | Bad request | * X-Rate-Limit-Limit - * X-Rate-Limit-Remaining - * X-Rate-Limit-Reset - |
404 | Not Found | * X-Rate-Limit-Limit - * X-Rate-Limit-Remaining - * X-Rate-Limit-Reset - |
429 | Rate Limiting | * X-Rate-Limit-Limit - * X-Rate-Limit-Remaining - * X-Rate-Limit-Reset - |
localeDownload(projectId, id, xPhraseAppOTP, branch, fileFormat, tags, tag, includeEmptyTranslations, excludeEmptyZeroForms, includeTranslatedKeys, keepNotranslateTags, convertEmoji, formatOptions, encoding, skipUnverifiedTranslations, includeUnverifiedTranslations, useLastReviewedVersion, fallbackLocaleId)
Download a locale
Download a locale in a specific file format.
// Import classes:
import com.phrase.client.ApiClient;
import com.phrase.client.ApiException;
import com.phrase.client.Configuration;
import com.phrase.client.auth.*;
import com.phrase.client.models.*;
import com.phrase.client.api.LocalesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.phrase.com/v2");
// Configure HTTP basic authorization: Basic
HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic");
Basic.setUsername("YOUR USERNAME");
Basic.setPassword("YOUR PASSWORD");
// Configure API key authorization: Token
ApiKeyAuth Token = (ApiKeyAuth) defaultClient.getAuthentication("Token");
Token.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Token.setApiKeyPrefix("Token");
LocalesApi apiInstance = new LocalesApi(defaultClient);
String projectId = "projectId_example"; // String | Project ID
String id = "id_example"; // String | ID
String xPhraseAppOTP = "xPhraseAppOTP_example"; // String | Two-Factor-Authentication token (optional)
String branch = my-feature-branch; // String | specify the branch to use
String fileFormat = yml; // String | File format name. See the format guide for all supported file formats.
String tags = feature1,feature2; // String | Limit results to keys tagged with a list of comma separated tag names.
String tag = feature; // String | Limit download to tagged keys. This parameter is deprecated. Please use the \"tags\" parameter instead
Boolean includeEmptyTranslations = true; // Boolean | Indicates whether keys without translations should be included in the output as well.
Boolean excludeEmptyZeroForms = true; // Boolean | Indicates whether zero forms should be included when empty in pluralized keys.
Boolean includeTranslatedKeys = true; // Boolean | Include translated keys in the locale file. Use in combination with include_empty_translations to obtain only untranslated keys.
Boolean keepNotranslateTags = true; // Boolean | Indicates whether [NOTRANSLATE] tags should be kept.
Boolean convertEmoji = true; // Boolean | This option is obsolete. Projects that were created on or after Nov 29th 2019 or that did not contain emoji by then will not require this flag any longer since emoji are now supported natively.
Object formatOptions = null; // Object | Additional formatting and render options. See the <a href=\"https://help.phrase.com/help/supported-platforms-and-formats\">format guide</a> for a list of options available for each format. Specify format options like this: <code>...&format_options[foo]=bar</code>
String encoding = "encoding_example"; // String | Enforces a specific encoding on the file contents. Valid options are \"UTF-8\", \"UTF-16\" and \"ISO-8859-1\".
Boolean skipUnverifiedTranslations = true; // Boolean | Indicates whether the locale file should skip all unverified translations. This parameter is deprecated and should be replaced with <code>include_unverified_translations</code>.
Boolean includeUnverifiedTranslations = true; // Boolean | if set to false unverified translations are excluded
Boolean useLastReviewedVersion = true; // Boolean | If set to true the last reviewed version of a translation is used. This is only available if the review workflow (currently in beta) is enabled for the project.
String fallbackLocaleId = "fallbackLocaleId_example"; // 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 <code>true</code>.
try {
apiInstance.localeDownload(projectId, id, xPhraseAppOTP, branch, fileFormat, tags, tag, includeEmptyTranslations, excludeEmptyZeroForms, includeTranslatedKeys, keepNotranslateTags, convertEmoji, formatOptions, encoding, skipUnverifiedTranslations, includeUnverifiedTranslations, useLastReviewedVersion, fallbackLocaleId);
} catch (ApiException e) {
System.err.println("Exception when calling LocalesApi#localeDownload");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
projectId | String | Project ID | |
id | String | ID | |
xPhraseAppOTP | String | Two-Factor-Authentication token (optional) | [optional] |
branch | String | specify the branch to use | [optional] |
fileFormat | String | File format name. See the format guide for all supported file formats. | [optional] |
tags | String | Limit results to keys tagged with a list of comma separated tag names. | [optional] |
tag | String | Limit download to tagged keys. This parameter is deprecated. Please use the "tags" parameter instead | [optional] |
includeEmptyTranslations | Boolean | Indicates whether keys without translations should be included in the output as well. | [optional] |
excludeEmptyZeroForms | Boolean | Indicates whether zero forms should be included when empty in pluralized keys. | [optional] |
includeTranslatedKeys | Boolean | Include translated keys in the locale file. Use in combination with include_empty_translations to obtain only untranslated keys. | [optional] |
keepNotranslateTags | Boolean | Indicates whether [NOTRANSLATE] tags should be kept. | [optional] |
convertEmoji | Boolean | This option is obsolete. Projects that were created on or after Nov 29th 2019 or that did not contain emoji by then will not require this flag any longer since emoji are now supported natively. | [optional] |
formatOptions | Object | Additional formatting and render options. See the <a href="https://help.phrase.com/help/supported-platforms-and-formats\">format guide</a> for a list of options available for each format. Specify format options like this: <code>...&format_options[foo]=bar</code> | [optional] |
encoding | String | Enforces a specific encoding on the file contents. Valid options are "UTF-8", "UTF-16" and "ISO-8859-1". | [optional] |
skipUnverifiedTranslations | Boolean | Indicates whether the locale file should skip all unverified translations. This parameter is deprecated and should be replaced with <code>include_unverified_translations</code>. | [optional] |
includeUnverifiedTranslations | Boolean | if set to false unverified translations are excluded | [optional] |
useLastReviewedVersion | Boolean | If set to true the last reviewed version of a translation is used. This is only available if the review workflow (currently in beta) is enabled for the project. | [optional] |
fallbackLocaleId | 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 <code>true</code>. | [optional] |
null (empty response body)
- Content-Type: Not defined
- Accept: Not defined
Status code | Description | Response headers |
---|---|---|
200 | OK | * X-Rate-Limit-Limit - * X-Rate-Limit-Remaining - * X-Rate-Limit-Reset - |
400 | Bad request | * X-Rate-Limit-Limit - * X-Rate-Limit-Remaining - * X-Rate-Limit-Reset - |
404 | Not Found | * X-Rate-Limit-Limit - * X-Rate-Limit-Remaining - * X-Rate-Limit-Reset - |
429 | Rate Limiting | * X-Rate-Limit-Limit - * X-Rate-Limit-Remaining - * X-Rate-Limit-Reset - |
LocaleDetails localeShow(projectId, id, xPhraseAppOTP, branch)
Get a single locale
Get details on a single locale for a given project.
// Import classes:
import com.phrase.client.ApiClient;
import com.phrase.client.ApiException;
import com.phrase.client.Configuration;
import com.phrase.client.auth.*;
import com.phrase.client.models.*;
import com.phrase.client.api.LocalesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.phrase.com/v2");
// Configure HTTP basic authorization: Basic
HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic");
Basic.setUsername("YOUR USERNAME");
Basic.setPassword("YOUR PASSWORD");
// Configure API key authorization: Token
ApiKeyAuth Token = (ApiKeyAuth) defaultClient.getAuthentication("Token");
Token.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Token.setApiKeyPrefix("Token");
LocalesApi apiInstance = new LocalesApi(defaultClient);
String projectId = "projectId_example"; // String | Project ID
String id = "id_example"; // String | ID
String xPhraseAppOTP = "xPhraseAppOTP_example"; // String | Two-Factor-Authentication token (optional)
String branch = my-feature-branch; // String | specify the branch to use
try {
LocaleDetails result = apiInstance.localeShow(projectId, id, xPhraseAppOTP, branch);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling LocalesApi#localeShow");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
projectId | String | Project ID | |
id | String | ID | |
xPhraseAppOTP | String | Two-Factor-Authentication token (optional) | [optional] |
branch | String | specify the branch to use | [optional] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | OK | * X-Rate-Limit-Limit - * X-Rate-Limit-Remaining - * X-Rate-Limit-Reset - |
400 | Bad request | * X-Rate-Limit-Limit - * X-Rate-Limit-Remaining - * X-Rate-Limit-Reset - |
404 | Not Found | * X-Rate-Limit-Limit - * X-Rate-Limit-Remaining - * X-Rate-Limit-Reset - |
429 | Rate Limiting | * X-Rate-Limit-Limit - * X-Rate-Limit-Remaining - * X-Rate-Limit-Reset - |
LocaleDetails localeUpdate(projectId, id, localeUpdateParameters, xPhraseAppOTP)
Update a locale
Update an existing locale.
// Import classes:
import com.phrase.client.ApiClient;
import com.phrase.client.ApiException;
import com.phrase.client.Configuration;
import com.phrase.client.auth.*;
import com.phrase.client.models.*;
import com.phrase.client.api.LocalesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.phrase.com/v2");
// Configure HTTP basic authorization: Basic
HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic");
Basic.setUsername("YOUR USERNAME");
Basic.setPassword("YOUR PASSWORD");
// Configure API key authorization: Token
ApiKeyAuth Token = (ApiKeyAuth) defaultClient.getAuthentication("Token");
Token.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Token.setApiKeyPrefix("Token");
LocalesApi apiInstance = new LocalesApi(defaultClient);
String projectId = "projectId_example"; // String | Project ID
String id = "id_example"; // String | ID
LocaleUpdateParameters localeUpdateParameters = new LocaleUpdateParameters(); // LocaleUpdateParameters |
String xPhraseAppOTP = "xPhraseAppOTP_example"; // String | Two-Factor-Authentication token (optional)
try {
LocaleDetails result = apiInstance.localeUpdate(projectId, id, localeUpdateParameters, xPhraseAppOTP);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling LocalesApi#localeUpdate");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
projectId | String | Project ID | |
id | String | ID | |
localeUpdateParameters | LocaleUpdateParameters | ||
xPhraseAppOTP | String | Two-Factor-Authentication token (optional) | [optional] |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | OK | * X-Rate-Limit-Limit - * X-Rate-Limit-Remaining - * X-Rate-Limit-Reset - |
400 | Bad request | * X-Rate-Limit-Limit - * X-Rate-Limit-Remaining - * X-Rate-Limit-Reset - |
404 | Not Found | * X-Rate-Limit-Limit - * X-Rate-Limit-Remaining - * X-Rate-Limit-Reset - |
429 | Rate Limiting | * X-Rate-Limit-Limit - * X-Rate-Limit-Remaining - * X-Rate-Limit-Reset - |
List<Locale> localesList(projectId, xPhraseAppOTP, page, perPage, branch)
List locales
List all locales for the given project.
// Import classes:
import com.phrase.client.ApiClient;
import com.phrase.client.ApiException;
import com.phrase.client.Configuration;
import com.phrase.client.auth.*;
import com.phrase.client.models.*;
import com.phrase.client.api.LocalesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.phrase.com/v2");
// Configure HTTP basic authorization: Basic
HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic");
Basic.setUsername("YOUR USERNAME");
Basic.setPassword("YOUR PASSWORD");
// Configure API key authorization: Token
ApiKeyAuth Token = (ApiKeyAuth) defaultClient.getAuthentication("Token");
Token.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Token.setApiKeyPrefix("Token");
LocalesApi apiInstance = new LocalesApi(defaultClient);
String projectId = "projectId_example"; // String | Project ID
String xPhraseAppOTP = "xPhraseAppOTP_example"; // String | Two-Factor-Authentication token (optional)
Integer page = 1; // Integer | Page number
Integer perPage = 25; // Integer | allows you to specify a page size up to 100 items, 25 by default
String branch = my-feature-branch; // String | specify the branch to use
try {
List<Locale> result = apiInstance.localesList(projectId, xPhraseAppOTP, page, perPage, branch);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling LocalesApi#localesList");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
projectId | String | Project ID | |
xPhraseAppOTP | String | Two-Factor-Authentication token (optional) | [optional] |
page | Integer | Page number | [optional] |
perPage | Integer | allows you to specify a page size up to 100 items, 25 by default | [optional] |
branch | String | specify the branch to use | [optional] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | OK | * X-Rate-Limit-Limit - * X-Rate-Limit-Remaining - * X-Rate-Limit-Reset - * Link - |
400 | Bad request | * X-Rate-Limit-Limit - * X-Rate-Limit-Remaining - * X-Rate-Limit-Reset - |
404 | Not Found | * X-Rate-Limit-Limit - * X-Rate-Limit-Remaining - * X-Rate-Limit-Reset - |
429 | Rate Limiting | * X-Rate-Limit-Limit - * X-Rate-Limit-Remaining - * X-Rate-Limit-Reset - |