# General Translation Platform: getLocaleEmoji
URL: https://generaltranslation.com/en-US/docs/platform/core/reference/utility-functions/locales/get-locale-emoji.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: Return an emoji marker for a locale or region without a GT instance. API reference for getLocaleEmoji.

[`getLocaleEmoji`](/docs/platform/core/reference/gt-class-methods/locales/get-locale-emoji) is a standalone utility function from General Translation's Core library that returns an emoji flag or symbol for a locale code. It selects a country or territory flag based on the locale's region, with support for custom emoji mappings.

## Overview [#overview]

Import `getLocaleEmoji` directly from `generaltranslation` and call it with a locale code. 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 [`getLocaleEmoji`](/docs/platform/core/reference/gt-class-methods/locales/get-locale-emoji) method on a [`GT`](/docs/platform/core/reference/gt-class/constructor) instance instead.

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

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

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

Signature:

```typescript
getLocaleEmoji(locale: string, customMapping?: CustomMapping): string
```

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

- **Region-based selection.** Uses the locale's region (when present) to select a flag emoji, using Unicode Regional Indicator Symbols. Falls back to default emojis for certain languages.
- **Custom mapping priority.** Emojis defined in a [`customMapping`](/docs/platform/core/reference/types/custom-mapping) take priority over region-based selection.
- **Fallback.** Returns a default globe emoji (`🌍`) for unrecognized locales.

## Parameters [#parameters]

| Parameter | Description | Type | Optional | Default |
| --- | --- | --- | --- | --- |
| [`locale`](#locale) | BCP-47 locale code to get the emoji for. | `string` | No | — |
| [`customMapping`](#custom-mapping) | Custom mapping for locale codes and emoji overrides. | [`CustomMapping`](/docs/platform/core/reference/types/custom-mapping) | Yes | — |

### `locale` [#locale]

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

The BCP-47 locale code to get the emoji for.

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

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

An optional custom mapping for locale codes and emoji overrides.

## Returns [#returns]

**Type** `string`

An emoji flag or symbol representing the locale:

- A country/territory flag emoji for locales with regions (for example, `🇺🇸`, `🇫🇷`, `🇯🇵`).
- A custom emoji, if defined in the mapping.
- The default globe emoji (`🌍`) for unrecognized locales.

## Examples [#examples]

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

// Common country flags
console.log(getLocaleEmoji('en-US')); // "🇺🇸"
console.log(getLocaleEmoji('fr-FR')); // "🇫🇷"
console.log(getLocaleEmoji('de-DE')); // "🇩🇪"
console.log(getLocaleEmoji('ja-JP')); // "🇯🇵"
console.log(getLocaleEmoji('zh-CN')); // "🇨🇳"

// Regions with multiple languages
console.log(getLocaleEmoji('en-CA')); // "🇨🇦"
console.log(getLocaleEmoji('fr-CA')); // "🇨🇦"
console.log(getLocaleEmoji('de-CH')); // "🇨🇭"
console.log(getLocaleEmoji('fr-CH')); // "🇨🇭"
```

## Notes [#notes]

- Returns flag emojis using Unicode Regional Indicator Symbols.
- Custom mapping emojis take priority over region-based selection.
- Supports all ISO 3166-1 alpha-2 region codes for comprehensive coverage.

## Sitemap

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