# General Translation Platform: getLocaleProperties
URL: https://generaltranslation.com/en-GB/docs/platform/core/reference/utility-functions/locales/get-locale-properties.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: Return detailed locale properties without a GT instance. API reference for getLocaleProperties.

[`getLocaleProperties`](/docs/platform/core/reference/gt-class-methods/locales/get-locale-properties) is a standalone utility function from General Translation&#39;s Core library that returns detailed properties for a locale code, including display names, language, script and region information, and a representative emoji.

## Overview [#overview]

Import `getLocaleProperties` directly from `generaltranslation` and call it with a locale code and an optional display locale. It does not require an API key or a [GT](/docs/platform/core/reference/gt-class/constructor) instance. For the instance-based equivalent, use the [`getLocaleProperties`](/docs/platform/core/reference/gt-class-methods/locales/get-locale-properties) method on a [`GT`](/docs/platform/core/reference/gt-class/constructor) instance instead.

```typescript
import { getLocaleProperties } from 'generaltranslation';

const props = getLocaleProperties('fr-CA', 'en');
console.log(props.name); // "Canadian French"
console.log(props.nativeName); // "français canadien"
console.log(props.emoji); // "🇨🇦"
console.log(props.regionCode); // "CA"
```

Signature:

```typescript
getLocaleProperties(
  locale: string,
  defaultLocale?: string,
  customMapping?: CustomMapping
): LocaleProperties
```

## How it works [#how-it-works]

* **Comprehensive metadata.** Returns the full [`LocaleProperties`](/docs/platform/core/reference/types/locale-properties) object, including standard and maximised forms.
* **Native names.** Native names are always computed in the target locale itself, regardless of `defaultLocale`.
* **Custom mapping integration.** Custom mappings are checked first for all properties, support alias resolution and property overrides, and fall back to standard `Intl` APIs for unmapped codes. Aliased locales are resolved to their canonical locale.

*Note: display names use the CLDR dialect form. For example, `getLocaleProperties('es-MX', 'en').name` is &quot;Mexican Spanish&quot; (not &quot;Spanish (Mexico)&quot;), and `nativeName` is &quot;español de México&quot;.*

## Parameters [#parameters]

| Parameter                          | Description                                     | Type                                                                  | Optional | Default |
| ---------------------------------- | ----------------------------------------------- | --------------------------------------------------------------------- | -------- | ------- |
| [`locale`](#locale)                | BCP-47 locale code to get properties for.       | `string`                                                              | No       | —       |
| [`defaultLocale`](#default-locale) | Locale used for localising display names.       | `string`                                                              | Yes      | `en`    |
| [`customMapping`](#custom-mapping) | Custom mapping for locale codes and properties. | [`CustomMapping`](/docs/platform/core/reference/types/custom-mapping) | Yes      | —       |

### `locale` [#locale]

**Type** `string` · **Required**

The BCP-47 locale code to retrieve properties for.

### `defaultLocale` [#default-locale]

**Type** `string` · **Optional** · **Default** `en`

The locale used to localise the returned display names.

### `customMapping` [#custom-mapping]

**Type** [`CustomMapping`](/docs/platform/core/reference/types/custom-mapping) · **Optional**

An optional custom mapping for locale codes and properties.

## Returns [#returns]

**Type** [`LocaleProperties`](/docs/platform/core/reference/types/locale-properties)

A comprehensive object containing all locale information:

* `code`: standardised locale code.
* `name`: display name in the default locale.
* `nativeName`: display name in the locale itself.
* `languageCode`, `languageName`, `nativeLanguageName`: language information.
* `regionCode`, `regionName`, `nativeRegionName`: region information.
* `scriptCode`, `scriptName`, `nativeScriptName`: script information.
* `maximizedCode`, `minimizedCode`: canonical forms.
* `nameWithRegionCode`, `nativeNameWithRegionCode`: combined display formats.
* `emoji`: flag or representative emoji.

## Examples [#examples]

```typescript
import { getLocaleProperties } from 'generaltranslation';

// English display names
const enProps = getLocaleProperties('es-MX', 'en');
console.log(enProps.name); // "Mexican Spanish"
console.log(enProps.languageName); // "Spanish"
console.log(enProps.regionName); // "Mexico"
console.log(enProps.emoji); // "🇲🇽"

// French display names
const frProps = getLocaleProperties('es-MX', 'fr');
console.log(frProps.name); // "espagnol du Mexique"
console.log(frProps.languageName); // "espagnol"
console.log(frProps.regionName); // "Mexique"

// Native names are always in the target locale
console.log(enProps.nativeName); // "español de México"
console.log(frProps.nativeName); // "español de México"
```

## Notes [#notes]

* Provides locale data without instantiating the GT class.
* Custom mapping properties take precedence over standard `Intl` APIs.
* The complete [`LocaleProperties`](/docs/platform/core/reference/types/locale-properties) object is always returned.
* Native names are always computed in the target locale itself.

## Sitemap

See the full [sitemap](https://generaltranslation.com/sitemap.md) for all pages.
