-1

I have some two-letter country codes that I want to covert them into a country name with localised language, like US -> United States if the user is using English HK -> 香港 if the user is using Chinese etc Is there any way to do this?

David Berry
  • 40,941
  • 12
  • 84
  • 95
Cheuk Lun Ho
  • 49
  • 1
  • 6

1 Answers1

0

You can look at this answer to get the system region. You can put the system languages in a dictionary to determine the country.

A caveat -- this method, as mentioned in the answer, returns the region, not necessarily the system language. Most of the time, they'll be the same, but if a user is multilingual, it might just take his region instead of all languages.

Community
  • 1
  • 1
erip
  • 16,374
  • 11
  • 66
  • 121