-
Notifications
You must be signed in to change notification settings - Fork 33
Description
Summary
Add support for retrieving nationalities (demonyms) for countries. Currently, the library provides comprehensive country data (names, phone codes, regions, flags, currency codes) but lacks nationality information, which is a common requirement in forms and applications.
Use Case
When building applications that require user registration or profile management, it's often necessary to collect nationality information. For example:
- Immigration and visa applications
- International student registration systems
- HR systems for multinational companies
- E-commerce platforms with international shipping
- Government services and forms
Currently, developers need to maintain separate nationality lists or rely on external sources, which can be inconsistent and difficult to keep synchronized with country data.
Proposed Solution
Add methods to retrieve nationality/demonym data, similar to existing methods like GetCountryEmojiFlag() or GetPhoneCodeByCountryShortCode().
Potential API examples:
// Get nationality by country code
var nationality = helper.GetNationalityByCountryCode("GB"); // Returns "British"
// Get all nationalities
var nationalities = helper.GetNationalities();
// Returns Dictionary<string, string> or List<Nationality>
// Get nationality variants (some countries have multiple forms)
var variants = helper.GetNationalityVariants("GB");
// Returns ["British", "English", "Scottish", "Welsh", "Northern Irish"]Data Source
A reliable and authoritative source for this data is the UK Government's official list of nationalities, used for company registration and other official purposes:
https://www.gov.uk/government/publications/nationalities/list-of-nationalities
This source includes:
- Approximately 250+ nationalities and citizenship designations
- Regional variants (e.g., English, Scottish, Welsh for the UK)
- Special cases (e.g., Stateless, Congo vs DRC distinctions)
- Last updated: October 29, 2025
Benefits
- Consistency: Keep nationality data in sync with country data
- Offline Access: Maintains the library's principle of providing data without HTTP calls
- Completeness: Makes the library more comprehensive for international applications
- Reliability: Based on authoritative government sources
- Developer Experience: One-stop solution for all country-related data needs
Additional Notes
Finding reliable nationality data is challenging, and having this feature in CountryData.Standard would be valuable for the .NET community. This would complement existing features and align with the library's goal of providing standardized global data.
Similar to how the library handles regions and currency codes, nationality data could be stored in the same offline JSON format and loaded via the CountryHelper singleton pattern.