이 항목은 아직 평가되지 않았습니다.- 이 항목 평가

CultureInfo.TwoLetterISOLanguageName 속성

2013-12-13

현재 CultureInfo 언어를 나타내는 두 문자로 된 ISO 639-1 코드를 가져옵니다.

Namespace:  System.Globalization
어셈블리:  mscorlib(mscorlib.dll)
public virtual string TwoLetterISOLanguageName { get; }

속성 값

형식: System.String
현재 CultureInfo 개체의 언어를 나타내는 두 문자로 된 ISO 639-1 코드입니다.

예를 들어, 영어를 나타내는 두 문자로 된 약어는 "en"입니다. 고정 문화권에서는 TwoLetterISOLanguageName 속성이 문자열 "iv"를 반환합니다.

다음 예제에서는 선택한 문화권의 TwoLetterISOLanguageName 속성 값을 표시합니다. 그런 다음 이 값을 사용하여 CultureInfo 개체를 인스턴스화하고, 선택한 문화권의 Parent 속성에서 반환한 부모 문화권과 이 개체를 비교합니다. 결과에서 볼 수 있듯이 대부분의 경우 이 두 CultureInfo 개체는 동일합니다. 실제 출력은 이 예제를 실행하는 플랫폼에 따라 달라질 수 있습니다.


using System;
using System.Globalization;
using System.Threading;

class Example
{
   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
   {
      // Define an array of selected culture names.
      string[] cultureCodes = {"ar-JO", "ar-SY", "az-Cyrl-AZ", "az-Latn-AZ", "zh-CN", 
                               "zh-SG", "zh-TW", "nl-BE", "nl-NL", "en-BZ", "en-CA", 
                               "en-NZ", "en-GB", "en-US", "fr-BE", "fr-CA", "fr-FR", 
                               "de-AT", "de-DE", "de-CH", "it-IT", "it-CH", "ms-BN",
                               "ms-MY", "nb-NO", "nn-NO", "pt-BR", "pt-PT", "sr-Cyrl-CS", 
                               "sr-Latn-CS", "es-AR", "es-DO", "es-MX", "es-ES", 
                               "es-ES_tradnl", "sv-FI", "sv-SE", "uz-Cyrl-UZ", "uz-Latn-UZ"};
      string exCultureName = null;

      // Iterate array and create a CultureInfo object for each culture name.
      foreach (string cultureCode in cultureCodes)
      {
         try {
            exCultureName = cultureCode;
            outputBlock.Text += String.Format("{0}: ", cultureCode);
            CultureInfo ci = new CultureInfo(cultureCode);
            // Get this culture's parent.
            CultureInfo cip = ci.Parent;
            outputBlock.Text += String.Format("Parent is {0}, ", cip.Name);
            // Get the culture's two-letter language name.
            string isoName = ci.TwoLetterISOLanguageName;
            outputBlock.Text += String.Format("Language name is '{0}', ", isoName);
            // Instantiate the neutral culture using the two-letter language name.
            exCultureName = isoName;
            CultureInfo ciNeutral = new CultureInfo(isoName);

            // Determine whether the parent object equals the neutral culture.
            outputBlock.Text += String.Format("Equality: {0}\n", 
                                              cip.Equals(ciNeutral));
         }
         catch (ArgumentException) {
            outputBlock.Text += String.Format("Unable to instantiate culture '{0}'.\n", exCultureName);
         }
      }
   }
}
// The example displays the following output:
//    ar-JO: Parent is ar, Language name is 'ar', Equality: True
//    ar-SY: Parent is ar, Language name is 'ar', Equality: True
//    az-Cyrl-AZ: Parent is az, Language name is 'az', Equality: True
//    az-Latn-AZ: Parent is az, Language name is 'az', Equality: True
//    zh-CN: Parent is zh-Hans, Language name is 'zh', Unable to instantiate culture 'zh'.
//    zh-SG: Parent is zh-Hans, Language name is 'zh', Unable to instantiate culture 'zh'.
//    zh-TW: Parent is zh-Hant, Language name is 'zh', Unable to instantiate culture 'zh'.
//    nl-BE: Parent is nl, Language name is 'nl', Equality: True
//    nl-NL: Parent is nl, Language name is 'nl', Equality: True
//    en-BZ: Parent is en, Language name is 'en', Equality: True
//    en-CA: Parent is en, Language name is 'en', Equality: True
//    en-NZ: Parent is en, Language name is 'en', Equality: True
//    en-GB: Parent is en, Language name is 'en', Equality: True
//    en-US: Parent is en, Language name is 'en', Equality: True
//    fr-BE: Parent is fr, Language name is 'fr', Equality: True
//    fr-CA: Parent is fr, Language name is 'fr', Equality: True
//    fr-FR: Parent is fr, Language name is 'fr', Equality: True
//    de-AT: Parent is de, Language name is 'de', Equality: True
//    de-DE: Parent is de, Language name is 'de', Equality: True
//    de-CH: Parent is de, Language name is 'de', Equality: True
//    it-IT: Parent is it, Language name is 'it', Equality: True
//    it-CH: Parent is it, Language name is 'it', Equality: True
//    ms-BN: Parent is ms, Language name is 'ms', Equality: True
//    ms-MY: Parent is ms, Language name is 'ms', Equality: True
//    nb-NO: Parent is no, Language name is 'nb', Unable to instantiate culture 'nb'.
//    nn-NO: Parent is no, Language name is 'nn', Unable to instantiate culture 'nn'.
//    pt-BR: Parent is pt, Language name is 'pt', Equality: True
//    pt-PT: Parent is pt, Language name is 'pt', Equality: True
//    sr-Cyrl-CS: Parent is , Language name is 'sr', Unable to instantiate culture 'sr'.
//    sr-Latn-CS: Parent is , Language name is 'sr', Unable to instantiate culture 'sr'.
//    es-AR: Parent is es, Language name is 'es', Equality: True
//    es-DO: Parent is es, Language name is 'es', Equality: True
//    es-MX: Parent is es, Language name is 'es', Equality: True
//    es-ES: Parent is es, Language name is 'es', Equality: True
//    es-ES_tradnl: Parent is es, Language name is 'es', Equality: True
//    sv-FI: Parent is sv, Language name is 'sv', Equality: True
//    sv-SE: Parent is sv, Language name is 'sv', Equality: True
//    uz-Cyrl-UZ: Parent is uz, Language name is 'uz', Equality: True
//    uz-Latn-UZ: Parent is uz, Language name is 'uz', Equality: True


Windows Phone OS

지원되는 버전: 8.0, 7.1, 7.0

Windows Phone

이 정보가 도움이 되었습니까?
(1500자 남음)
의견을 주셔서 감사합니다.
표시:
© 2014 Microsoft. All rights reserved.