Locale
The Locale object represents a language or language variant within a project and forms the basis for the localization of content in the LocaleUI platform. It defines the target languages into which the content of a project is to be translated.
Each project has at least one source language (default locale) and can be extended by any number of target languages. Available locales can be called up via the API. Each locale is uniquely identified by its language code (e.g. en, de, fr-CA) and supplemented with additional metadata such as name or status.
The interface makes it possible to retrieve all stored languages in a project. The API ID, name, code and country are returned for each language.
Properties:
-
Method:
GET
-
Endpoint:
https://localeui.com/api/v1/projects/[Project API ID]/locales
- Authentication: Required (bearer token)
-
Path parameters:
-
Project API ID
(String) - The unique API ID of the project
-
Example request:
Command line$ curl -X GET https://localeui.com/api/v1/projects/[Project API ID]/locales \ -H "Authorization: Bearer [Your API token]" \ -H "Content-Type: application/json"
Example response:
In response to a valid request to the interfacecontains a list of all languages (locales) stored in the project. Each locale is described by a unique identifier and by language and country information. In addition, it is specified whether a locale is the main language (default locale) of the project. Shown in the following example.
Response 200 OK[ { "api_id": "loc_12345678901234567890", "name": English, "code": en, "main": true, "country": { "alpha2": gb, "name": United Kingdom }, ... ]
Response field description
api_id
name
code
en
, de
, fr
.main
true
or false
).country.alpha2
GB
, DE
, FR
.country.name