How the various CultureInfo names and tags behave.

How the various CultureInfo names and tags behave.

With the introduction of sort names and custom cultures in the .Net Framework 2.0 (Whidbey) a few things about culture names had to be clarified. Three are 4 ways you can get names that look a lot like culture names:

I listed these in the following table. Note that in the following table, fj-FJ is a custom culture created using en-US as its sort.

new CultureInfo()

.ToString()

.Name

.CompareInfo.Name

.IetfLanguageTag

en-US

en-US

en-US

en-US

en-US

de-de_phoneb

de-DE_phoneb

de-DE

de-DE_phoneb

de-DE

fj-FJ (custom)

fj-FJ

fj-FJ

en-US

fj-FJ

uz-UZ-Latn

uz-UZ-Latn

uz-UZ-Latn

uz-UZ-Latn

uz-Latn-UZ

en-CB

en-CB

en-CB

en-CB

en-029

CultureInfo.ToString() basically is the same string as was used to create the CultureInfo.If you need to get the exact same culture back, including sorting behavior, this is what you’ll have to use.

CultureInfo.Name is the culture name without any sort-specific information.This is great for resource lookup.

CultureInfo.CompareInfo.Name is the name of the sort for this culture. Multiple cultures could refer to the same sort, particularly for custom cultures where users choose an existing sort.This is good to know which sort your using, particularly with Custom Cultures, which must choose an existing culture for sort behavior.

CultureInfo.IetfLanguageTag provides the IETF language tag for this culture. This might be different that the culture name. CultureInfo names generally have the script last and IETF tags generally have the script in the middle, although there are other differences. Some cultures like en-CB have a different name completely.IETF language tag is what you’d expect in an http accept-language request, and other common standard protocols.

I hope this summary helps those of you trying to figure out what name’s what. Remember of course that this describes the behavior of the Whidbey Beta 2 product, so its actual RTM behavior could change.