# General Translation Platform: getLocaleProperties URL: https://generaltranslation.com/en-US/docs/platform/core/reference/utility-functions/locales/get-locale-properties.mdx --- title: getLocaleProperties 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'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 maximized 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 "Mexican Spanish" (not "Spanish (Mexico)"), and `nativeName` is "español de México".* ## Parameters [#parameters] | Parameter | Description | Type | Optional | Default | | --- | --- | --- | --- | --- | | [`locale`](#locale) | BCP-47 locale code to get properties for. | `string` | No | — | | [`defaultLocale`](#default-locale) | Locale used to localize 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 get properties for. ### `defaultLocale` [#default-locale] **Type** `string` · **Optional** · **Default** `en` The locale used to localize 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`: standardized 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 GT class instantiation. - Custom mapping properties take precedence over standard `Intl` APIs. - The complete `LocaleProperties` object is always returned. - Native names are always computed in the target locale itself.