We can probably list all the recognised countries in the world by pulling out all of the timezone and internationalization data burned into Windows. To list all windows cultures
But we want to focus on just the country names, so lets move on to
[System.Globalization.Cultureinfo]::getcultures([System.Globalization.CultureTypes]::SpecificCultures)| ?{$_.englishname -eq "English (United Kingdom)"}|fl
Which produces this:
Parent : en
LCID : 2057
KeyboardLayoutId : 2057
Name : en-GB
IetfLanguageTag : en-GB
DisplayName : English (United Kingdom)
NativeName : English (United Kingdom)
EnglishName : English (United Kingdom)
TwoLetterISOLanguageName : en
ThreeLetterISOLanguageName : eng
ThreeLetterWindowsLanguageName : ENG
CompareInfo : CompareInfo - 2057
TextInfo : TextInfo - 2057
IsNeutralCulture : False
CultureTypes : SpecificCultures, InstalledWin32Cultures, FrameworkCultures
NumberFormat : System.Globalization.NumberFormatInfo
DateTimeFormat : System.Globalization.DateTimeFormatInfo
Calendar : System.Globalization.GregorianCalendar
OptionalCalendars : {System.Globalization.GregorianCalendar, System.Globalization.GregorianCalendar}
UseUserOverride : True
IsReadOnly : False
And is clearly just a list of locales :-(
We want a political listing, this list has only got 210 locales.
OK, so that was fun, but did not produce the answer we wanted, so here is a possible solution if you do have an internet connection at the time you want the actual data.
http://www.geonames.org/export/web-services.html#countryInfo
It's a web-service, and the logical choice for live data. If you are paranoid like me, an interresting test-case is to validate a recently added country, such as 'South Sudan' named in July 2011. So now you are starting to squeek, help, I can't use web services in Powershell! Whoa!!!! Nope, remember this is Powershell, and anything BASH can do, this can do also; so lets get moving.
[System.Globalization.Cultureinfo]::getcultures([System.Globalization.CultureTypes]::SpecificCultures)
But we want to focus on just the country names, so lets move on to
[System.Globalization.Cultureinfo]::getcultures([System.Globalization.CultureTypes]::SpecificCultures)| ?{$_.englishname -eq "English (United Kingdom)"}|fl
Which produces this:
Parent : en
LCID : 2057
KeyboardLayoutId : 2057
Name : en-GB
IetfLanguageTag : en-GB
DisplayName : English (United Kingdom)
NativeName : English (United Kingdom)
EnglishName : English (United Kingdom)
TwoLetterISOLanguageName : en
ThreeLetterISOLanguageName : eng
ThreeLetterWindowsLanguageName : ENG
CompareInfo : CompareInfo - 2057
TextInfo : TextInfo - 2057
IsNeutralCulture : False
CultureTypes : SpecificCultures, InstalledWin32Cultures, FrameworkCultures
NumberFormat : System.Globalization.NumberFormatInfo
DateTimeFormat : System.Globalization.DateTimeFormatInfo
Calendar : System.Globalization.GregorianCalendar
OptionalCalendars : {System.Globalization.GregorianCalendar, System.Globalization.GregorianCalendar}
UseUserOverride : True
IsReadOnly : False
And is clearly just a list of locales :-(
We want a political listing, this list has only got 210 locales.
OK, so that was fun, but did not produce the answer we wanted, so here is a possible solution if you do have an internet connection at the time you want the actual data.
http://www.geonames.org/export/web-services.html#countryInfo
It's a web-service, and the logical choice for live data. If you are paranoid like me, an interresting test-case is to validate a recently added country, such as 'South Sudan' named in July 2011. So now you are starting to squeek, help, I can't use web services in Powershell! Whoa!!!! Nope, remember this is Powershell, and anything BASH can do, this can do also; so lets get moving.
Nice blog and fantastic information thanks to you ..
ReplyDeleteKullu Manali Honeymoon Tour With Meal or Hotels & Transport Honeymoon Special at https://himachaltoursandtravels.com/
ReplyDeleteReally nice post. Thank you so much for sharing.
ReplyDeleteiNeedTrip provides best tour packages from India to different International destinations for Honeymoon & Holidays.
Best Travel & Tour Company in India
Best Travel Agents in India
Bali Tour Packages
Singapore Tour Packages
Mauritius Tour Packages
Maldives Tour Packages
Dubai Tour Packages