TypeScript
/@infobits/intl

API-referentie

API-referentie

Een volledig overzicht van alle publieke API's die beschikbaar zijn in elk pakket.

Typen

Country

VeldTypeBeschrijving
idstringUnieke identificatie (bijv. "unitedStates")
alpha2CodestringISO 3166-1 alfa-2 (bijv. "US")
alpha3CodestringISO 3166-1 alfa-3 (bijv. "USA")
numericCodenumberISO 3166-1 numeriek (bijv. 840)
nativeNamestringOorspronkelijke landnaam
capitalstringHoofdstad
mainLanguagestringPrimaire taalcode
languagesstring[]Alle gesproken taalcodes
tldstringTopniveaudomein
callingCodenumberInternationaal landnummer
continentstringContinentidentificatie
currencystringValutacode

Language

VeldTypeBeschrijving
idstringUnieke identificatie (bijv. "english")
codestringISO 639-1-code (bijv. "en")
nativeNamestringNaam in de taal zelf
dialectsLanguageDialect[]Regionale varianten
defaultFlagCodestring?Landcode voor representatieve vlag

LanguageDialect

VeldTypeBeschrijving
idstringUnieke identificatie
codestringDialectcode
nativeNamestringOorspronkelijke naam van het dialect
flagCodestring?Landcode voor de vlag van het dialect

Currency

VeldTypeBeschrijving
idstringUnieke identificatie (bijv. "usd")
codestringISO 4217-code (bijv. "USD")
nativeNamestringEnkelvoudige naam (bijv. "US Dollar")
nativeNamePluralstringMeervoudige naam (bijv. "US Dollars")
symbolstringValutasymbool (bijv. "$")

Continent

VeldTypeBeschrijving
idstringUnieke identificatie (bijv. "europe")
codestringTweeletterige code (bijv. "EU")
namestringEngelse weergavenaam

Opzoekfuncties

Landen

GoDartTypeScript
// TypeScript
getCountryByAlpha2(code: string): Country | undefined
getCountryByAlpha3(code: string): Country | undefined
getCountriesByContinent(continent: string): Country[]
getCountriesInContinent(code: string): Country[]

Talen

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

Valuta's

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

Continenten

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

Vlaggen

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

Emojivlaggen

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

Enums / Constanten

Elk pakket biedt typeveilige constanten voor alle codes:

GoDartTypeScript
// TypeScript — string enums
CountryCode.US    // "US"
LanguageCode.FR   // "FR"
CurrencyCode.EUR  // "EUR"
ContinentCode.EU  // "EU"

Vertaalfuncties

Alle vertaalfuncties nemen een entiteitcode en een taalgebiedcode en retourneren de gelokaliseerde naam.

Beschikbare taalgebieden: da, de, en, es, fr, it, zh

GoDartTypeScript
// 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

Vertaalmappen

Voor bulktoegang zijn de ruwe vertaalmappen beschikbaar:

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