API-referentie
API-referentie
Een volledig overzicht van alle publieke API's die beschikbaar zijn in elk pakket.
Typen
Country
| Veld | Type | Beschrijving |
|---|---|---|
id | string | Unieke identificatie (bijv. "unitedStates") |
alpha2Code | string | ISO 3166-1 alfa-2 (bijv. "US") |
alpha3Code | string | ISO 3166-1 alfa-3 (bijv. "USA") |
numericCode | number | ISO 3166-1 numeriek (bijv. 840) |
nativeName | string | Oorspronkelijke landnaam |
capital | string | Hoofdstad |
mainLanguage | string | Primaire taalcode |
languages | string[] | Alle gesproken taalcodes |
tld | string | Topniveaudomein |
callingCode | number | Internationaal landnummer |
continent | string | Continentidentificatie |
currency | string | Valutacode |
Language
| Veld | Type | Beschrijving |
|---|---|---|
id | string | Unieke identificatie (bijv. "english") |
code | string | ISO 639-1-code (bijv. "en") |
nativeName | string | Naam in de taal zelf |
dialects | LanguageDialect[] | Regionale varianten |
defaultFlagCode | string? | Landcode voor representatieve vlag |
LanguageDialect
| Veld | Type | Beschrijving |
|---|---|---|
id | string | Unieke identificatie |
code | string | Dialectcode |
nativeName | string | Oorspronkelijke naam van het dialect |
flagCode | string? | Landcode voor de vlag van het dialect |
Currency
| Veld | Type | Beschrijving |
|---|---|---|
id | string | Unieke identificatie (bijv. "usd") |
code | string | ISO 4217-code (bijv. "USD") |
nativeName | string | Enkelvoudige naam (bijv. "US Dollar") |
nativeNamePlural | string | Meervoudige naam (bijv. "US Dollars") |
symbol | string | Valutasymbool (bijv. "$") |
Continent
| Veld | Type | Beschrijving |
|---|---|---|
id | string | Unieke identificatie (bijv. "europe") |
code | string | Tweeletterige code (bijv. "EU") |
name | string | Engelse weergavenaam |
Opzoekfuncties
Landen
// Go
intl.CountryByAlpha2(code string) (Country, bool)
intl.CountryByAlpha3(code string) (Country, bool)
intl.AllCountries() []Country
intl.CountriesByContinent(continent string) []CountryTalen
// Go
intl.LanguageByCode(code string) (Language, bool)
intl.AllLanguages() []LanguageValuta's
// Go
intl.CurrencyByCode(code string) (Currency, bool)
intl.AllCurrencies() []CurrencyContinenten
// Go
intl.ContinentByCode(code string) (Continent, bool)
intl.AllContinents() []ContinentVlaggen
// Go
intl.GetFlag(alpha2 string) (string, bool)
intl.Flags // map[string]stringEmojivlaggen
// Go
code.EmojiFlag() string // on CountryCodeEnums / Constanten
Elk pakket biedt typeveilige constanten voor alle codes:
// 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
// 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:
// Go
i18n.CountriesTranslations // map[string]map[string]string
i18n.LanguagesTranslations
i18n.CurrenciesTranslations
i18n.ContinentsTranslations
i18n.CapitalsTranslations