I tried to use a ISO-3166 two letter country code to create my C# culture info object to format my datetime objects according to the locale.
If I try:
var cultureInfo = new CultureInfo("FR");
it works fine, if I try:
var cultureInfo = new CultureInfo("US");
it throws an exception:
Culture is not supported. Parameter name: name US is an invalid culture identifier.
The funny thing is that "US" is a valid ISO-3166 country code.
From CultureInfo(string) constructor documentation;
For a list of predefined culture names, see the National Language Support (NLS) API Reference
Also from CultureInfo.TwoLetterISOLanguageName Property
For example, the two-letter abbreviation for English is
en.
There is no US defined but there is en (if you really have to use two letter name) which you can use it. All of them defined in ISO 639-1 standard.
var cultureInfo = new CultureInfo("en");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With