Udostępnij za pośrednictwem


CultureInfo.EnglishName Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the culture name in the format "language (country/region)" in English.

Namespace:  System.Globalization
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Overridable ReadOnly Property EnglishName As String
public virtual string EnglishName { get; }

Property Value

Type: System.String
The culture name in the format "language (country/region)" in English, where language is the full name of the language and country/region is the full name of the country or region.

Remarks

For example, the EnglishName for the specific culture "en-US" is "English (United States)".

The value of this property is the same, regardless of the language version of the .NET Framework.

Examples

The following example displays the EnglishName property as well as the DisplayName and NativeName properties of several cultures.

Imports System.Globalization

Public Module Example
   Public Sub Demo(outputBlock As System.Windows.Controls.TextBlock)
      outputBlock.FontFamily = New FontFamily("Courier New")

      Dim cultureStrings() As String = {"nl-NL", "en", "en-US", "fr-FR", _
                                        "de-DE", "ru-RU", "sr-Cyrl-CS", _ 
                                        "sr-Latn-CS", "es-MX", "sv-SE"}
      outputBlock.Text += String.Format("{0,-12} {1,-30} {2,-30} {3,-30}", _
                                        "Culture", "DisplayName", "NativeName", _
                                        "EnglishName") + vbCrLf + vbCrLf
      For Each cultureString As String In cultureStrings
         Try
            Dim ci As New CultureInfo(cultureString)
            outputBlock.Text += String.Format("{0,-12} {1,-30} {2,-30} {3,-30}", _
                                              cultureString + ":", ci.DisplayName, _
                                              ci.NativeName, ci.EnglishName) + vbCrLf
         Catch e As ArgumentException
            outputBlock.Text += String.Format("Unable to create the {0} culture.", _
                                              cultureString) + vbCrLf
         End Try
      Next                                        
   End Sub
End Module
' The example displays the following output:
'    Culture      DisplayName                    NativeName                     EnglishName                   
'    
'    nl-NL:       Dutch (Netherlands)            Nederlands (Nederland)         Dutch (Netherlands)           
'    en:          English                        English                        English                       
'    en-US:       English (United States)        English (United States)        English (United States)       
'    fr-FR:       French (France)                français (France)              French (France)               
'    de-DE:       German (Germany)               Deutsch (Deutschland)          German (Germany)              
'    ru-RU:       Russian (Russia)               русский (Россия)               Russian (Russia)              
'    sr-Cyrl-CS:  Serbian (Cyrillic, Serbia)     српски (Србија)                Serbian (Cyrillic, Serbia)    
'    sr-Latn-CS:  Serbian (Latin, Serbia)        srpski (Srbija)                Serbian (Latin, Serbia)       
'    es-MX:       Spanish (Mexico)               Español (México)               Spanish (Mexico)              
'    sv-SE:       Swedish (Sweden)               svenska (Sverige)              Swedish (Sweden)              
using System;
using System.Globalization;
using System.Windows.Media;

public class Example
{
   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
   {
      outputBlock.FontFamily = new FontFamily("Courier New");

      string[] cultureStrings= {"nl-NL", "en", "en-US", "fr-FR", 
                                "de-DE", "ru-RU", "sr-Cyrl-CS",  
                                "sr-Latn-CS", "es-MX", "sv-SE"};
      outputBlock.Text += String.Format("{0,-12} {1,-30} {2,-30} {3,-30}\n\n", 
                                        "Culture", "DisplayName", "NativeName", 
                                        "EnglishName"); 
      foreach (string cultureString in cultureStrings)
      {
         try {
            CultureInfo ci = new CultureInfo(cultureString);
            outputBlock.Text += String.Format("{0,-12} {1,-30} {2,-30} {3,-30}\n", 
                                              cultureString + ":", ci.DisplayName, 
                                              ci.NativeName, ci.EnglishName);
         }
         catch (ArgumentException) {
            outputBlock.Text += String.Format("Unable to create the {0} culture.\n", cultureString);
         }
      }                                        
   }
}
// The example displays the following output:
//    Culture      DisplayName                    NativeName                     EnglishName                   
//    
//    nl-NL:       Dutch (Netherlands)            Nederlands (Nederland)         Dutch (Netherlands)           
//    en:          English                        English                        English                       
//    en-US:       English (United States)        English (United States)        English (United States)       
//    fr-FR:       French (France)                français (France)              French (France)               
//    de-DE:       German (Germany)               Deutsch (Deutschland)          German (Germany)              
//    ru-RU:       Russian (Russia)               русский (Россия)               Russian (Russia)              
//    sr-Cyrl-CS:  Serbian (Cyrillic, Serbia)     српски (Србија)                Serbian (Cyrillic, Serbia)    
//    sr-Latn-CS:  Serbian (Latin, Serbia)        srpski (Srbija)                Serbian (Latin, Serbia)       
//    es-MX:       Spanish (Mexico)               Español (México)               Spanish (Mexico)              
//    sv-SE:       Swedish (Sweden)               svenska (Sverige)              Swedish (Sweden)              

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.