emoji

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: Apache-2.0, MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package emoji holds the Unicode emoji catalog and multi-language CLDR names and keywords for base.EmojiPicker, generated from emojibase-data by go generate (internal/gen).

Everything is loaded lazily on first call with no package init, so Go's linker drops the embedded data completely from apps that never reach EmojiPicker or its lookup helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeLocales

func NormalizeLocales(langs []string) []string

NormalizeLocales resolves langs to deduplicated supported locales, appending English as a fallback when it was not already requested.

func ResolveLocale

func ResolveLocale(tag string) string

ResolveLocale maps a BCP 47 locale tag to the closest supported emoji locale, or "" when none matches.

func SupportedLocales

func SupportedLocales() []string

SupportedLocales returns the sorted list of locale codes bundled in emoji.bin.

Types

type Category

type Category uint8

Category is one of the nine Unicode emoji groups (excluding Component).

const (
	Smileys Category = iota
	People
	Animals
	Food
	Travel
	Activities
	Objects
	Symbols
	Flags
)

type Entry

type Entry struct {
	Index    int
	Emoji    string
	Category Category
	Skins    []string
}

Entry is one emoji's language-independent data.

func Base

func Base() []Entry

Base returns all Unicode emoji entries in standard order.

type Item

type Item struct {
	Index    int
	Emoji    string
	Name     string
	Keywords []string
	Category Category
	Skins    []string
}

Item is a localized emoji returned by lookup and search.

func AllInCategory

func AllInCategory(cat Category, langs []string) []Item

AllInCategory returns every emoji in cat localized in langs.

func ByString

func ByString(s string, langs []string) (Item, bool)

ByString looks up an emoji (base or skin-toned, with or without U+FE0F) and returns its localized Item, preserving any skin tone in Item.Emoji.

func ItemAt

func ItemAt(index int, langs []string) Item

ItemAt returns the localized Item at index in Base().

func Search(query string, langs []string) []Item

Search matches every emoji against query across all languages in langs (resolved and deduplicated, with English fallback). Empty queries return all emojis in Unicode order.

type LocaleEntry

type LocaleEntry struct {
	Name           string
	FoldedName     string
	Keywords       []string
	FoldedKeywords []string
}

LocaleEntry is one emoji's name and keywords in a single language.

func LocaleTable

func LocaleTable(loc string) []LocaleEntry

LocaleTable returns the localized names and keywords for a resolved locale code (e.g. "en", "zh", "ja"), inflating it once on demand.

Directories

Path Synopsis
internal
gen command
Command gen writes emoji.bin, the Unicode emoji catalog and multi-language CLDR names and keywords for package base/internal/emoji, from a pinned release of emojibase-data: go generate ./base/internal/emoji runs it.
Command gen writes emoji.bin, the Unicode emoji catalog and multi-language CLDR names and keywords for package base/internal/emoji, from a pinned release of emojibase-data: go generate ./base/internal/emoji runs it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL