Skip to main content

getLocales

Get all active locales.

Description​

Fetches the project's active locales and resolves to an array of ILocalEntity objects.

.getLocales();

Examples​

Minimal example​

const response = await Locales.getLocales();

Example response​

[
{
"id": 146,
"shortCode": "en",
"code": "en_US",
"name": "English (USA)",
"nativeName": "English (USA)",
"isActive": true,
"image": null,
"position": 1
},
{
"id": 48,
"shortCode": "ru",
"code": "ru_RU",
"name": "Russian",
"nativeName": "русский язык",
"isActive": true,
"image": null,
"position": 2
}
]

Response schema​

Schema: ILocalEntity[]

id: number
ID of the language.
example: 1

shortCode: string
Short language code, for example "en".
example: "en"

code: string
Full language code, such as en_US.
example: "en_US"

name: string
Name of the language.
example: "English"

nativeName: string
Name of the language in that language.
example: "English"

isActive: boolean
Whether the language is active.
example: true

image: string | null
Image associated with the language.
example: "https://example.com/images/en.png"

position: number
Position of the language in the list.
example: 1