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
GoDartTypeScript
// TypeScript
getCountryByAlpha2(code: string): Country | undefined
getCountryByAlpha3(code: string): Country | undefined
getCountriesByContinent(continent: string): Country[]
getCountriesInContinent(code: string): Country[]Langues
GoDartTypeScript
// TypeScript
getLanguageByCode(code: string): Language | undefinedDevises
GoDartTypeScript
// TypeScript
getCurrencyByCode(code: string): Currency | undefinedContinents
GoDartTypeScript
// TypeScript
getContinentByCode(code: string): Continent | undefinedDrapeaux
GoDartTypeScript
// TypeScript
getFlag(alpha2: string): string | undefined
flags // Record<string, string>Drapeaux emoji
GoDartTypeScript
// TypeScript
getEmojiFlag(alpha2: string): stringEnums / Constantes
Chaque package fournit des constantes typees pour tous les codes :
GoDartTypeScript
// TypeScript — string enums
CountryCode.US // "US"
LanguageCode.FR // "FR"
CurrencyCode.EUR // "EUR"
ContinentCode.EU // "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
// 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 | undefinedCartes de traductions
Pour un acces en masse, les cartes de traductions brutes sont disponibles :
GoDartTypeScript
// TypeScript
countriesTranslations // Record<string, Record<string, string>>
languagesTranslations
currenciesTranslations
continentsTranslations
capitalsTranslations