C# - Get ISO 639-2 three-letter code from language name and country name

505 Views Asked by At

The problem

I've got the following information:

  • Language name
  • Country

An example would be: English, United States

This information needs to be converted into an ISO 639-2 three-letter code. It might be good to know that I'm using dotnet 6 with C# 10.

What I looked at so far

So far, I tried using the CultureInfo. Sadly, CultureInfo does not take a language and a country. I'm aware of the RegionInfo class, but from my understanding, it does not contain a mapping for all countries and it requires as an input something like "en-US" which I do not have.

0

There are 0 best solutions below