Skip to content

Worldwide Country Informations (ISO-3166-1 Alpha2, ISO-3166-1 Alpha3, ISO 639-1)

License

Notifications You must be signed in to change notification settings

OpenBoxLab/Nager.Country

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nager.Country

The Worldwide Country Informations are available over the nuget package or as json in the zip package. The collection contains the Informations for 250 Countries.

Example Data

{
  "commonName": "Austria",
  "officialName": "Republic of Austria",
  "nativeName": "Österreich",
  "translations": [
    {
      "languageCode": "EN",
      "name": "Austria"
    },
    {
      "languageCode": "ES",
      "name": "Austria"
    },
    {
      "languageCode": "FR",
      "name": "Autriche"
    },
    ...
  ],
  "alpha2Code": "AT",
  "alpha3Code": "AUT",
  "numericCode": 40,
  "tld": [
    ".at"
  ],
  "region": "Europe",
  "subRegion": "Western Europe",
  "borderCountries": [
    "CZ",
    "DE",
    "HU",
    "IT",
    "LI",
    "SK",
    "SI",
    "CH"
  ],
  "currencies": [
    {
      "symbol": "€",
      "singular": "euro",
      "plural": "euro",
      "isoCode": "EUR",
      "numericCode": "978",
      "name": "Euro"
    }
  ],
  "callingCodes": [
    "43"
  ]
}

nuget nuget.org download count

The package is available via NuGet

PM> install-package Nager.Country
PM> install-package Nager.Country.Translation

Examples of use

Get all countries

var countryProvider = new CountryProvider();
var countries = countryProvider.GetCountries();

Get country via CountryName

var countryProvider = new CountryProvider();
var countryInfo = countryProvider.GetCountryByName("Germany");
//countryInfo.Alpha2Code -> DE
//countryInfo.Alpha3Code -> DEU
//countryInfo.NumericCode -> 276
//countryInfo.Region -> Europe
//countryInfo.SubRegion -> WesternEurope
//countryInfo...

Get country via CountryName and consider Country Translation

Require the translation package Install-Package Nager.Country.Translation

var countryProvider = new CountryProvider();
var countryInfo = countryProvider.GetCountryByNameConsiderTranslation("Germania"); // <- Germany
//countryInfo.Alpha2Code -> DE
//countryInfo.Alpha3Code -> DEU
//countryInfo.NumericCode -> 276
//countryInfo.Region -> Europe
//countryInfo.SubRegion -> WesternEurope
//countryInfo...

Get the name of the country in the requested language (nuget -> Nager.Country.Translation)

var translationProvider = new TranslationProvider();
var translatedCountryName = translationProvider.GetCountryTranslatedName(Alpha2Code.DE, LanguageCode.EN);
//translatedCountryName -> Germany
var translationProvider = new TranslationProvider();
var languages = translationProvider.GetLanguages();

Interesting projects

Language Project
* mledoze countries
* umpirsky country-list
* dr5hn countries-states-cities-database
javascript michaelwittig node-i18n-iso-countries
.net anghelvalentin CountryValidator

About

Worldwide Country Informations (ISO-3166-1 Alpha2, ISO-3166-1 Alpha3, ISO 639-1)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%