# General Translation Platform: getLocaleEmoji
URL: https://generaltranslation.com/en-GB/docs/platform/core/reference/gt-class-methods/locales/get-locale-emoji.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: Return an emoji marker for a locale or region. API reference for getLocaleEmoji.

Retrieves an emoji flag or symbol for a locale code on a [GT](/docs/platform/core/reference/gt-class/constructor) instance, based on its region. General Translation returns country and territory flag emojis, with fallbacks for languages without a specific region and support for custom emoji through mappings.

## Overview [#overview]

Call `getLocaleEmoji` on a [`GT`](/docs/platform/core/reference/gt-class/constructor) instance with an optional locale code. When omitted, it uses the instance&#39;s `targetLocale`.

```typescript
const gt = new GT({ sourceLocale: 'en', targetLocale: 'fr-CA' });

const emoji = gt.getLocaleEmoji('fr-CA');
console.log(emoji); // "🇨🇦" (Canadian flag)

const usEmoji = gt.getLocaleEmoji('en-US');
console.log(usEmoji); // "🇺🇸" (US flag)

const enEmoji = gt.getLocaleEmoji('en');
console.log(enEmoji); // "🇺🇸" (US flag)
```

Signature:

```typescript
getLocaleEmoji(locale?: string): string
```

*Note: `getLocaleEmoji` runs locally and does not require an API key. It uses the instance&#39;s `targetLocale` when `locale` is omitted. For lookups without a `GT` instance, see the standalone [`getLocaleEmoji`](/docs/platform/core/reference/utility-functions/locales/get-locale-emoji).*

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

* **Region-based selection.** Uses the locale&#39;s region code (when available) to select a flag emoji, built from Unicode regional indicator symbols.
* **Custom mapping priority.** Emojis defined in a [`CustomMapping`](/docs/platform/core/reference/types/custom-mapping) take priority over region-based selection.
* **Fallbacks.** Returns a language-specific emoji for some languages without regions, and the default globe emoji `🌍` for unrecognised or invalid locales.
* **Missing locale.** Throws an `Error` if no locale is provided and the instance has no `targetLocale` configured.

## Parameters [#parameters]

| Parameter           | Description                              | Type     | Optional | Default             |
| ------------------- | ---------------------------------------- | -------- | -------- | ------------------- |
| [`locale`](#locale) | BCP-47 locale code to get the emoji for. | `string` | Yes      | `this.targetLocale` |

### `locale` [#locale]

**Type** `string` · **Optional** · **Default** `this.targetLocale`

BCP-47 locale code to get the emoji for. If not provided, uses the instance&#39;s `targetLocale`.

## Returns [#returns]

**Type** `string`

An emoji flag or symbol representing the locale:

* Country/territory flag emoji for locales with regions (for example, `🇺🇸`, `🇫🇷`, `🇯🇵`).
* Language-specific emoji for some languages without regions.
* Default globe emoji (`🌍`) for unrecognised locales.

Throws an `Error` if no locale is provided and the instance has no `targetLocale` configured.

## Examples [#examples]

```typescript
const gt = new GT({ sourceLocale: 'en', targetLocale: 'es' });

// Get emoji for target locale
console.log(gt.getLocaleEmoji()); // "🇪🇸" (uses targetLocale 'es')

// Get emojis for different locales
console.log(gt.getLocaleEmoji('en-US')); // "🇺🇸"
console.log(gt.getLocaleEmoji('fr-FR')); // "🇫🇷"
console.log(gt.getLocaleEmoji('de-DE')); // "🇩🇪"
console.log(gt.getLocaleEmoji('ja-JP')); // "🇯🇵"
console.log(gt.getLocaleEmoji('zh-CN')); // "🇨🇳"
```

## Notes [#notes]

* Returns flag emojis based on the locale&#39;s region code when available.
* Custom mapping emojis take priority over region-based selection.
* Uses Unicode regional indicator symbols for flag generation.
* Defaults to `🌍` (globe) for unrecognised or invalid locales.
* Compatible with all modern browsers and operating systems that support Unicode emojis.

## Sitemap

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