# generaltranslation: General Translation Core SDK: getLocaleEmoji URL: https://generaltranslation.com/en-US/docs/core/class/methods/locales/get-locale-emoji.mdx --- title: getLocaleEmoji description: API reference for the GT getLocaleEmoji method --- ## Overview The `getLocaleEmoji` method retrieves an emoji flag or symbol for a locale code based on its region. It returns appropriate flag emojis for countries and territories, with fallbacks for languages without specific regions and custom emoji support through mappings. ```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) ``` --- ## Reference ### Parameters ### Parameters description | Parameter | Description | |-----------|-------------| | `locale` | BCP-47 locale code to get emoji for. If not provided, uses the instance's `targetLocale` | ### Returns `string` - Emoji flag or symbol representing the locale: - Country/territory flag emoji for locales with regions (e.g., `πŸ‡ΊπŸ‡Έ`, `πŸ‡«πŸ‡·`, `πŸ‡―πŸ‡΅`) - Language-specific emoji for some languages without regions - Default flag emoji (`🏳️`) for unrecognized locales ### Throws - `Error` - If no locale is provided and the instance has no `targetLocale` configured --- ## 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 - Returns flag emojis based on the locale's region code when available - Custom mapping emojis take priority over region-based selection - Uses Unicode regional indicator symbols for flag generation - Defaults to `🏳️` (white flag) for unrecognized or invalid locales - Compatible with all modern browsers and operating systems that support Unicode emojis ## Next steps - Get locale properties with [`getLocaleProperties`](/docs/core/class/methods/locales/get-locale-properties) - Get locale names with [`getLocaleName`](/docs/core/class/methods/locales/get-locale-name) - Validate locales with [`isValidLocale`](/docs/core/class/methods/locales/is-valid-locale) - [Learn about CustomMapping type](/docs/core/types/custom-mapping)