API Reference

API Reference

A complete reference of all public APIs available in each package.

Types

Country

FieldTypeDescription
idstringUnique identifier (e.g. "unitedStates")
alpha2CodestringISO 3166-1 alpha-2 (e.g. "US")
alpha3CodestringISO 3166-1 alpha-3 (e.g. "USA")
numericCodenumberISO 3166-1 numeric (e.g. 840)
nativeNamestringNative country name
capitalstringCapital city
mainLanguagestringPrimary language code
languagesstring[]All spoken language codes
tldstringTop-level domain
callingCodenumberInternational calling code
continentstringContinent identifier
currencystringCurrency code

Language

FieldTypeDescription
idstringUnique identifier (e.g. "english")
codestringISO 639-1 code (e.g. "en")
nativeNamestringName in the language itself
dialectsLanguageDialect[]Regional variations
defaultFlagCodestring?Country code for representative flag

LanguageDialect

FieldTypeDescription
idstringUnique identifier
codestringDialect code
nativeNamestringNative name of the dialect
flagCodestring?Country code for the dialect's flag

Currency

FieldTypeDescription
idstringUnique identifier (e.g. "usd")
codestringISO 4217 code (e.g. "USD")
nativeNamestringSingular name (e.g. "US Dollar")
nativeNamePluralstringPlural name (e.g. "US Dollars")
symbolstringCurrency symbol (e.g. "$")

Continent

FieldTypeDescription
idstringUnique identifier (e.g. "europe")
codestringTwo-letter code (e.g. "EU")
namestringEnglish display name

Lookup Functions

Countries

GoDartTypeScriptphp
// Go
intl.CountryByAlpha2(code string) (Country, bool)
intl.CountryByAlpha3(code string) (Country, bool)
intl.AllCountries() []Country
intl.CountriesByContinent(continent string) []Country

Languages

GoDartTypeScriptphp
// Go
intl.LanguageByCode(code string) (Language, bool)
intl.AllLanguages() []Language

Currencies

GoDartTypeScriptphp
// Go
intl.CurrencyByCode(code string) (Currency, bool)
intl.AllCurrencies() []Currency

Continents

GoDartTypeScriptphp
// Go
intl.ContinentByCode(code string) (Continent, bool)
intl.AllContinents() []Continent

Flags

GoDartTypeScriptphp
// Go
intl.GetFlag(alpha2 string) (string, bool)
intl.Flags  // map[string]string

Emoji Flags

GoDartTypeScriptphp
// Go
code.EmojiFlag() string  // on CountryCode

Enums / Constants

Each package provides type-safe constants for all codes:

GoDartTypeScriptphp
// Go — typed string constants
intl.CountryUS    // CountryCode("US")
intl.LanguageFR   // LanguageCode("FR")
intl.CurrencyEUR  // CurrencyCode("EUR")
intl.ContinentEU  // ContinentCode("EU")

Translation Functions

All translation functions take an entity code and a locale code, returning the localized name.

Available locales: da, de, en, es, fr, it, zh

GoDartTypeScriptphp
// Go — all in the i18n sub-package
i18n.GetCountriesName(code, locale string) (string, bool)
i18n.GetLanguagesName(code, locale string) (string, bool)
i18n.GetCurrenciesName(code, locale string) (string, bool)
i18n.GetContinentsName(code, locale string) (string, bool)
i18n.GetCapitalsName(code, locale string) (string, bool)

Translation Maps

For bulk access, raw translation maps are available:

GoDartTypeScriptphp
// Go
i18n.CountriesTranslations   // map[string]map[string]string
i18n.LanguagesTranslations
i18n.CurrenciesTranslations
i18n.ContinentsTranslations
i18n.CapitalsTranslations