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.

Get all locales

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": Deutsch, "code": de, "main": true, "country": { "alpha2": de, "name": Germany }, ... ]

Response field description

Field
Type
Description
api_id
String
Unique identifier of the locale for API purposes.
name
String
Display name of the language, e.g. “English”, “German”. Set by the user.
code
String
Language code according to ISO 639-1, e.g. en, de, fr.
main
Boolean
Specifies whether this locale is the main language of the project (true or false).
country.alpha2
String
Two-letter country code according to ISO 3166-1 alpha-2, e.g. GB, DE, FR.
country.name
String
Full name of the country associated with the locale, e.g. “United Kingdom”, “Germany”, “France”.