# General Translation Platform: getRegionProperties URL: https://generaltranslation.com/en-US/docs/platform/core/reference/gt-class-methods/locales/get-region-properties.mdx --- title: getRegionProperties description: Return region metadata for a locale or region code. API reference for getRegionProperties. --- Retrieves details about a region code on a [GT](/docs/platform/core/reference/gt-class/constructor) instance, including its localized name and associated emoji flag. General Translation provides a convenient way to get region-specific display information for building internationalized user interfaces. ## Overview [#overview] Call `getRegionProperties` on a [`GT`](/docs/platform/core/reference/gt-class/constructor) instance with an optional region code. When omitted, it uses the region from the instance's target locale. ```typescript const gt = new GT({ sourceLocale: 'en-US', targetLocale: 'fr-FR' }); // Get region properties const usProps = gt.getRegionProperties('US'); console.log(usProps); // { code: 'US', name: 'Γ‰tats-Unis', emoji: 'πŸ‡ΊπŸ‡Έ' } const frProps = gt.getRegionProperties('FR'); console.log(frProps); // { code: 'FR', name: 'France', emoji: 'πŸ‡«πŸ‡·' } // Auto-detect from current locale const currentRegion = gt.getRegionProperties(); // Uses targetLocale's region console.log(currentRegion); // { code: 'FR', name: 'France', emoji: 'πŸ‡«πŸ‡·' } ``` Signature: ```typescript getRegionProperties( region?: string, customMapping?: CustomRegionMapping ): { code: string; name: string; emoji: string } ``` *Note: `getRegionProperties` runs locally using `Intl.DisplayNames` and does not require an API key. It uses the region from the instance's `targetLocale` when `region` is omitted, and localizes the region name for the instance's `targetLocale`. For lookups without a `GT` instance, see the standalone [`getRegionProperties`](/docs/platform/core/reference/utility-functions/locales/get-region-properties).* ## How it works [#how-it-works] - **Region codes.** Accepts ISO 3166-1 alpha-2 or UN M.49 region codes (for example, `"US"`, `"FR"`, `"419"`). - **Localized names.** Uses `Intl.DisplayNames` to localize the region name for the instance's `targetLocale`, falling back to the library default locale. - **Custom mapping priority.** If a `customMapping` provides a `name` or `emoji` for the region, those override the defaults. - **Fallbacks.** Falls back to the region code as `name` if display name resolution fails, and to a default emoji if no emoji mapping is found. - **Region fallback.** When `region` is omitted, the region from the instance's target locale is used. - **Missing locale.** Throws an `Error` if no target locale is available to determine region properties. ## Parameters [#parameters] | Parameter | Description | Type | Optional | Default | | --- | --- | --- | --- | --- | | [`region`](#region) | ISO 3166-1 alpha-2 or UN M.49 region code. | `string` | Yes | `this.getLocaleProperties().regionCode` | | [`customMapping`](#custom-mapping) | Custom region mapping to override default names and emojis. | `CustomRegionMapping` | Yes | `this.customRegionMapping` | ### `region` [#region] **Type** `string` Β· **Optional** Β· **Default** `this.getLocaleProperties().regionCode` ISO 3166-1 alpha-2 or UN M.49 region code. If not provided, uses the region from the instance's target locale. ### `customMapping` [#custom-mapping] **Type** `CustomRegionMapping` Β· **Optional** Β· **Default** `this.customRegionMapping` Optional custom region mapping to override default region names and emojis. ## Returns [#returns] **Type** `{ code: string; name: string; emoji: string }` An object containing: - `code`: the input region code. - `name`: the localized (or custom) region name in the target locale language. - `emoji`: the associated emoji flag or symbol. ## Examples [#examples] ```typescript // Basic region information const gt = new GT({ sourceLocale: 'en-US', targetLocale: 'en-US' }); // Common region codes console.log(gt.getRegionProperties('US')); // { code: 'US', name: 'United States', emoji: 'πŸ‡ΊπŸ‡Έ' } console.log(gt.getRegionProperties('GB')); // { code: 'GB', name: 'United Kingdom', emoji: 'πŸ‡¬πŸ‡§' } console.log(gt.getRegionProperties('DE')); // { code: 'DE', name: 'Germany', emoji: 'πŸ‡©πŸ‡ͺ' } console.log(gt.getRegionProperties('JP')); // { code: 'JP', name: 'Japan', emoji: 'πŸ‡―πŸ‡΅' } ``` ```typescript // Custom region mapping overrides the defaults const gt = new GT({ targetLocale: 'en-US' }); console.log(gt.getRegionProperties('US', { US: { name: 'USA', emoji: 'πŸ—½' } })); // { code: 'US', name: 'USA', emoji: 'πŸ—½' } ``` ## Notes [#notes] - Uses the `Intl.DisplayNames` API for localized region names. - Supports both ISO 3166-1 alpha-2 and UN M.49 region codes. - Custom mappings override default names and emojis. - Automatically detects the region from the target locale if no parameter is provided. - Falls back to the region code as the name if display name resolution fails.