This topic has not yet been rated - Rate this topic

CultureInfo.Name Property

Updated: October 2011

Gets the culture name in the format "languagecode2-country/regioncode2".

Namespace:  System.Globalization
Assembly:  mscorlib (in mscorlib.dll)
public virtual string Name { get; }

Property Value

Type: System.String
The culture name in the format "languagecode2-country/regioncode2", where languagecode2 is a lowercase two-letter code derived from ISO 639-1 and country/regioncode2 is an uppercase two-letter code derived from ISO 3166.

For a list of predefined culture names and identifiers that the Name property can return, see the National Language Support (NLS) API Reference at the Go Global Developer Center. Note that culture names are subject to change, and that they also can reflect the names of custom cultures.

The CultureInfo.Name property follows the naming standards provided in the CultureInfo class topic.

To get the full name of the culture, the application should use DisplayName, EnglishName, or NativeName.

The following code example displays several properties of the neutral cultures.

Note Note

The example displays the older "zh-CHS" and "zh-CHT" culture names with the 0x0004 and 0x7C04 culture identifiers, respectively. However, your Windows Vista applications should use the zh-Hans name instead of "zh-CHS" and the zh-Hant name instead of "zh-CHT". The zh-Hans and zh-Hant names represent the current standard, and should be used unless you have a reason for using the older names.


using System;
using System.Globalization;

public class SamplesCultureInfo
{

   public static void Main()
   {

      // Displays several properties of the neutral cultures.
      Console.WriteLine("CULTURE ISO ISO WIN DISPLAYNAME                              ENGLISHNAME");
      foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.NeutralCultures))
      {
         Console.Write("{0,-7}", ci.Name);
         Console.Write(" {0,-3}", ci.TwoLetterISOLanguageName);
         Console.Write(" {0,-3}", ci.ThreeLetterISOLanguageName);
         Console.Write(" {0,-3}", ci.ThreeLetterWindowsLanguageName);
         Console.Write(" {0,-40}", ci.DisplayName);
         Console.WriteLine(" {0,-40}", ci.EnglishName);
      }

   }

}


/*
This code produces the following output.  This output has been cropped for brevity.

CULTURE ISO ISO WIN DISPLAYNAME                              ENGLISHNAME
ar      ar  ara ARA Arabic                                   Arabic                                  
bg      bg  bul BGR Bulgarian                                Bulgarian                               
ca      ca  cat CAT Catalan                                  Catalan                                 
zh-Hans zh  zho CHS Chinese (Simplified)                     Chinese (Simplified)                    
cs      cs  ces CSY Czech                                    Czech                                   
da      da  dan DAN Danish                                   Danish                                  
de      de  deu DEU German                                   German                                  
el      el  ell ELL Greek                                    Greek                                   
en      en  eng ENU English                                  English                                 
es      es  spa ESP Spanish                                  Spanish                                 
fi      fi  fin FIN Finnish                                  Finnish                                 
zh      zh  zho CHS Chinese                                  Chinese                                 
zh-Hant zh  zho CHT Chinese (Traditional)                    Chinese (Traditional)                   
zh-CHS  zh  zho CHS Chinese (Simplified) Legacy              Chinese (Simplified) Legacy             
zh-CHT  zh  zho CHT Chinese (Traditional) Legacy             Chinese (Traditional) Legacy            

*/


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Date

History

Reason

October 2011

Added a link to predefined culture names.

Customer feedback.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
.NET Framework 3.5 and 4.0 differ from standards? I'm confused :-)
This document says, "<languagecode2>-<country/regioncode2>", where <languagecode2> is a lowercase two-letter code derived from ISO 639-1 ...", this is not consistent with what is actually returned by GetCultures(), and EnumSystemLocales().  For example: smn-FI, quz-BO, etc. do not comply with this documentation, but are valid .NET language names.  In Win32, one would need to use LOCALE_SABBREVLANGNAME in special cases rather than the ideal LOCALE_SISO639LANGNAME to form a valid language name.

In addition, the document says, "...and <country/regioncode2> is an uppercase two-letter code derived from ISO 3166", and this too is not consistent.  For example: zh-Hans, is "Chinese" using the script "Hans" where this script name is actually from ISO 15924 (which is not even mentioned in this document at all).  The current standard according to the Library of Congress would be zh-CN for "Chinese" in "China", and this can be made more specific by using a script tag (from ISO 15924) such as "zh-Hans-CN" for simplified or "zh-Hant-CN" for traditional (using the format in accordance with RFE-4646).

What am I missing here?