# General Translation Platform: getLocaleEmoji URL: https://generaltranslation.com/en-US/docs/platform/core/reference/utility-functions/locales/get-locale-emoji.mdx --- title: getLocaleEmoji 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.