TypeScript
/@infobits/intl

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
// TypeScript
getCountryByAlpha2(code: string): Country | undefined
getCountryByAlpha3(code: string): Country | undefined
getCountriesByContinent(continent: string): Country[]
getCountriesInContinent(code: string): Country[]

Languages

GoDartTypeScriptphp
// TypeScript
getLanguageByCode(code: string): Language | undefined

Currencies

GoDartTypeScriptphp
// TypeScript
getCurrencyByCode(code: string): Currency | undefined

Continents

GoDartTypeScriptphp
// TypeScript
getContinentByCode(code: string): Continent | undefined

Flags

GoDartTypeScriptphp
// TypeScript
getFlag(alpha2: string): string | undefined
flags  // Record<string, string>

Emoji Flags

GoDartTypeScriptphp
// TypeScript
getEmojiFlag(alpha2: string): string

Enums / Constants

Each package provides type-safe constants for all codes:

GoDartTypeScriptphp
// TypeScript — string enums
CountryCode.US    // "US"
LanguageCode.FR   // "FR"
CurrencyCode.EUR  // "EUR"
ContinentCode.EU  // "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
// TypeScript
getCountriesName(code: string, locale: string): string | undefined
getLanguagesName(code: string, locale: string): string | undefined
getCurrenciesName(code: string, locale: string): string | undefined
getContinentsName(code: string, locale: string): string | undefined
getCapitalsName(code: string, locale: string): string | undefined

Translation Maps

For bulk access, raw translation maps are available:

GoDartTypeScriptphp
// TypeScript
countriesTranslations   // Record<string, Record<string, string>>
languagesTranslations
currenciesTranslations
continentsTranslations
capitalsTranslations