Acquiring the names of the countries of a channel

How do I acquire the names of the countries of a channel?

From ChannelModel.Channel.CountryLinks I can get the CountrySystemId which I feed to the Get function of CountryService, that will give me a Country entity. But that entity doesn’t seem to have any obvious way to acquire the name of the country that is being shown in BackOffice?

Litium version: 7.1.0

Did you pass in the culture?

On the country entity you get the ID for the country, for example “SE” for Sweden. You can get the display name by using RegionInfo like this:

var name = new RegionInfo(id).DisplayName;

3 Likes

@NilsN, that solves my problem, thank you.

Just a shorthand note for people who find this topic, DisplayName will get you the name in the language of the localized version of .NET Framework, EnglishName will get it in English and NativeName will get it in the native language of that country (that’s the one I was looking for, so I get “Sverige” for Sweden, etc.).

2 Likes