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
// Go
intl.CountryByAlpha2(code string) (Country, bool)
intl.CountryByAlpha3(code string) (Country, bool)
intl.AllCountries() []Country
intl.CountriesByContinent(continent string) []Country

Talen

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

Valuta's

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

Continenten

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

Vlaggen

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

Emojivlaggen

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

Enums / Constanten

Elk pakket biedt typeveilige constanten voor alle codes:

GoDartTypeScript
// Go — typed string constants
intl.CountryUS    // CountryCode("US")
intl.LanguageFR   // LanguageCode("FR")
intl.CurrencyEUR  // CurrencyCode("EUR")
intl.ContinentEU  // ContinentCode("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
// 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)

Vertaalmappen

Voor bulktoegang zijn de ruwe vertaalmappen beschikbaar:

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