I need to get the two letter ISO region name, ISO 3166
- ISO 3166-1 alpha 2
, for countries. My problem is that I only have the country names in Swedish, for example Sverige
for Sweden
and Tyskland
for Germany
. Is it possible to get RegionInfo from only this information? I know it is possible for English country names.
Works:
var countryName = "Sweden";
//var countryName = "Denmark";
var regions = CultureInfo.GetCultures(CultureTypes.SpecificCultures).Select(x => new RegionInfo(x.LCID));
var englishRegion = regions.FirstOrDefault(region => region.EnglishName.Contains(countryName));
var twoLetterISORegionName = englishRegion.TwoLetterISORegionName;