Reference API
Reference API
Une reference complete de toutes les API publiques disponibles dans chaque package.
Types
Country
| Champ | Type | Description |
|---|---|---|
id | string | Identifiant unique (ex. "unitedStates") |
alpha2Code | string | ISO 3166-1 alpha-2 (ex. "US") |
alpha3Code | string | ISO 3166-1 alpha-3 (ex. "USA") |
numericCode | number | Code numerique ISO 3166-1 (ex. 840) |
nativeName | string | Nom natif du pays |
capital | string | Capitale |
mainLanguage | string | Code de la langue principale |
languages | string[] | Codes de toutes les langues parlees |
tld | string | Domaine de premier niveau |
callingCode | number | Indicatif telephonique international |
continent | string | Identifiant du continent |
currency | string | Code de la devise |
Language
| Champ | Type | Description |
|---|---|---|
id | string | Identifiant unique (ex. "english") |
code | string | Code ISO 639-1 (ex. "en") |
nativeName | string | Nom dans la langue elle-meme |
dialects | LanguageDialect[] | Variantes regionales |
defaultFlagCode | string? | Code pays pour le drapeau representatif |
LanguageDialect
| Champ | Type | Description |
|---|---|---|
id | string | Identifiant unique |
code | string | Code du dialecte |
nativeName | string | Nom natif du dialecte |
flagCode | string? | Code pays pour le drapeau du dialecte |
Currency
| Champ | Type | Description |
|---|---|---|
id | string | Identifiant unique (ex. "usd") |
code | string | Code ISO 4217 (ex. "USD") |
nativeName | string | Nom au singulier (ex. "US Dollar") |
nativeNamePlural | string | Nom au pluriel (ex. "US Dollars") |
symbol | string | Symbole de la devise (ex. "$") |
Continent
| Champ | Type | Description |
|---|---|---|
id | string | Identifiant unique (ex. "europe") |
code | string | Code a deux lettres (ex. "EU") |
name | string | Nom d'affichage en anglais |
Fonctions de recherche
Pays
// Go
intl.CountryByAlpha2(code string) (Country, bool)
intl.CountryByAlpha3(code string) (Country, bool)
intl.AllCountries() []Country
intl.CountriesByContinent(continent string) []CountryLangues
// Go
intl.LanguageByCode(code string) (Language, bool)
intl.AllLanguages() []LanguageDevises
// Go
intl.CurrencyByCode(code string) (Currency, bool)
intl.AllCurrencies() []CurrencyContinents
// Go
intl.ContinentByCode(code string) (Continent, bool)
intl.AllContinents() []ContinentDrapeaux
// Go
intl.GetFlag(alpha2 string) (string, bool)
intl.Flags // map[string]stringDrapeaux emoji
// Go
code.EmojiFlag() string // on CountryCodeEnums / Constantes
Chaque package fournit des constantes typees pour tous les codes :
// Go — typed string constants
intl.CountryUS // CountryCode("US")
intl.LanguageFR // LanguageCode("FR")
intl.CurrencyEUR // CurrencyCode("EUR")
intl.ContinentEU // ContinentCode("EU")Fonctions de traduction
Toutes les fonctions de traduction prennent un code d'entite et un code de locale, et retournent le nom localise.
Locales disponibles : 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)Cartes de traductions
Pour un acces en masse, les cartes de traductions brutes sont disponibles :
// Go
i18n.CountriesTranslations // map[string]map[string]string
i18n.LanguagesTranslations
i18n.CurrenciesTranslations
i18n.ContinentsTranslations
i18n.CapitalsTranslations