Reference API

Reference API

Une reference complete de toutes les API publiques disponibles dans chaque package.

Types

Country

ChampTypeDescription
idstringIdentifiant unique (ex. "unitedStates")
alpha2CodestringISO 3166-1 alpha-2 (ex. "US")
alpha3CodestringISO 3166-1 alpha-3 (ex. "USA")
numericCodenumberCode numerique ISO 3166-1 (ex. 840)
nativeNamestringNom natif du pays
capitalstringCapitale
mainLanguagestringCode de la langue principale
languagesstring[]Codes de toutes les langues parlees
tldstringDomaine de premier niveau
callingCodenumberIndicatif telephonique international
continentstringIdentifiant du continent
currencystringCode de la devise

Language

ChampTypeDescription
idstringIdentifiant unique (ex. "english")
codestringCode ISO 639-1 (ex. "en")
nativeNamestringNom dans la langue elle-meme
dialectsLanguageDialect[]Variantes regionales
defaultFlagCodestring?Code pays pour le drapeau representatif

LanguageDialect

ChampTypeDescription
idstringIdentifiant unique
codestringCode du dialecte
nativeNamestringNom natif du dialecte
flagCodestring?Code pays pour le drapeau du dialecte

Currency

ChampTypeDescription
idstringIdentifiant unique (ex. "usd")
codestringCode ISO 4217 (ex. "USD")
nativeNamestringNom au singulier (ex. "US Dollar")
nativeNamePluralstringNom au pluriel (ex. "US Dollars")
symbolstringSymbole de la devise (ex. "$")

Continent

ChampTypeDescription
idstringIdentifiant unique (ex. "europe")
codestringCode a deux lettres (ex. "EU")
namestringNom d'affichage en anglais

Fonctions de recherche

Pays

GoDartTypeScript
// Go
intl.CountryByAlpha2(code string) (Country, bool)
intl.CountryByAlpha3(code string) (Country, bool)
intl.AllCountries() []Country
intl.CountriesByContinent(continent string) []Country

Langues

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

Devises

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

Continents

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

Drapeaux

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

Drapeaux emoji

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

Enums / Constantes

Chaque package fournit des constantes typees pour tous les codes :

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

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)

Cartes de traductions

Pour un acces en masse, les cartes de traductions brutes sont disponibles :

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