Names Associated with a CultureInfo Object
There are several variations of a culture name associated with CultureInfo and related classes, such as CompareInfo. The culture names are handled differently, depending on the constructor used for CultureInfo. The class defines two constructors for which the application passes a culture name, and two constructors handling a culture represented by identifier.
Name Handling when Culture Information is Constructed with a Culture Name
When passing a culture name to create a CultureInfo object, your application can use either of the constructors that takes a string representing the name. Let's consider an example in which the following strings are passed:
"en-US" for English (United States)
"de-DE_phoneb" for German (Germany) with phonebook sort, which is an alternate sort
"fj-FJ" for a custom culture, with the culture using the "en-US" sort order for string comparisons
The following table shows the culture names as handled by one of the string-based CultureInfo constructors and the related programming elements.
Element |
en-US |
de-DE_phoneb |
Custom culture |
---|---|---|---|
CultureInfo constructor |
en-US |
de-DE_phoneb |
fj-FJ |
CultureInfo.ToString |
en-US |
de-DE_phoneb |
fj-FJ |
CultureInfo.Name |
en-US |
de-DE |
fj-FJ |
TextInfo.CultureName |
en-US |
de-DE |
fj-FJ |
CompareInfo.Name |
en-US |
de-DE_phoneb |
en-US |
CultureInfo.ToString always returns exactly the value passed to the constructor, except that it "normalizes" the capitalization. For example, if an application passes "En-Us" to the constructor, ToString returns "en-US". CultureInfo.Name always gives a "short" form of the name that excludes any indication of an alternate sort, for example, "de-DE" instead of "de-DE_phoneb".
TextInfo.CultureName is always identical to CultureInfo.Name. Finally, CompareInfo.Name gives the name of the sort, even if it is completely unrelated to the name of the culture itself.
Name Handling when Culture Information is Constructed with a Culture Identifier
Your application can also pass a culture identifier to create a CultureInfo object. In this case, the application can use one of the constructors that takes an identifier value. Let's consider an example in which the culture identifiers passed to the constructor are:
0x0409 for English (United States)
0x10407 for German (Germany) with phonebook sort
0x0c00 for custom culture "fj-FJ", which must be the current default user culture; assume that this custom culture uses the "en-US" sort order for string comparisons
The following table shows the culture naming as handled by one of the identifier-based CultureInfo constructors and the related programming elements. Note that the names are exactly the same as for the previous example.
Element |
en-US |
de-DE_phoneb |
Custom culture |
---|---|---|---|
CultureInfo constructor |
0x0409 |
0x0407 |
0x0C00 |
CultureInfo.ToString |
en-US |
de-DE_phoneb |
fj-FJ |
CultureInfo.Name |
en-US |
de-DE |
fj-FJ |
TextInfo.CultureName |
en-US |
de-DE |
fj-FJ |
CompareInfo.Name |
en-US |
de-DE_phoneb |
en-US |
See Also
Reference
Concepts
Names Associated with a RegionInfo Object