Muokkaa

Jaa


CultureInfo.GetConsoleFallbackUICulture Method

Definition

Gets an alternate user interface culture suitable for console applications when the default graphic user interface culture is unsuitable.

public:
 System::Globalization::CultureInfo ^ GetConsoleFallbackUICulture();
public System.Globalization.CultureInfo GetConsoleFallbackUICulture ();
[System.Runtime.InteropServices.ComVisible(false)]
public System.Globalization.CultureInfo GetConsoleFallbackUICulture ();
member this.GetConsoleFallbackUICulture : unit -> System.Globalization.CultureInfo
[<System.Runtime.InteropServices.ComVisible(false)>]
member this.GetConsoleFallbackUICulture : unit -> System.Globalization.CultureInfo
Public Function GetConsoleFallbackUICulture () As CultureInfo

Returns

An alternate culture that is used to read and display text on the console.

Attributes

Examples

The following code example displays the fallback user interface culture associated with a culture object.

// This example demonstrates the GetConsoleFallbackUICulture() method
using namespace System;
using namespace System::Globalization;

int main()
{
    CultureInfo^ ci = gcnew CultureInfo("ar-DZ");
    Console::WriteLine("Culture name: . . . . . . . . . {0}", ci->Name);
    Console::WriteLine("Console fallback UI culture:. . {0}",
        ci->GetConsoleFallbackUICulture()->Name);
}
/*
This code example produces the following results:

Culture name: . . . . . . . . . ar-DZ
Console fallback UI culture:. . fr-FR

*/
// This example demonstrates the GetConsoleFallbackUICulture() method
using System;
using System.Globalization;

class Sample
{
    public static void Main()
    {
    CultureInfo ci = new CultureInfo("ar-DZ");
    Console.WriteLine("Culture name: . . . . . . . . . {0}", ci.Name);
    Console.WriteLine("Console fallback UI culture:. . {0}",
                       ci.GetConsoleFallbackUICulture().Name);
    }
}
/*
This code example produces the following results:

Culture name: . . . . . . . . . ar-DZ
Console fallback UI culture:. . fr-FR

*/
' This example demonstrates the GetConsoleFallbackUICulture() method
Imports System.Globalization

Class Sample
   Public Shared Sub Main()
      Dim ci As New CultureInfo("ar-DZ")
      Console.WriteLine("Culture name: . . . . . . . . . {0}", ci.Name)
      Console.WriteLine("Console fallback UI culture:. . {0}", _
                         ci.GetConsoleFallbackUICulture().Name)
   End Sub
End Class
'
'This code example produces the following results:
'
'Culture name: . . . . . . . . . ar-DZ
'Console fallback UI culture:. . fr-FR
'

Remarks

Languages such as Arabic, Hebrew, Urdu, and Syriac are based on bidirectional text. Windows applications, which have a graphical user interface, support bidirectional languages. However, console applications, which employ the text user interface of the operating system console, do not provide bidirectional support. Therefore, if you localize a console application to Arabic or Hebrew, your application displays unreadable text on the console screen.

The user interface culture specifies the resources an application needs to support user input and output, and by default is the same as the operating system culture. For example, the CultureInfo.CurrentUICulture property returns an Arabic culture for an Arabic operating system. Use the GetConsoleFallbackUICulture method to retrieve a culture suitable for a console application user interface. After your application retrieves the fallback user interface culture, it should assign the culture to the current user interface culture of the current thread. For more information, see the "Explicitly Setting the Current UI Culture" section of the CurrentUICulture property.

The following are predefined cultures that have a different fallback user interface culture name from the predefined culture name.

Predefined culture Culture name Fallback user interface culture name
Amharic am en-US
Amharic (Ethiopia) am-ET en-US
(neutral Arabic) ar en-US
Arabic (U.A.E.) ar-AE en-US
Arabic (Bahrain) ar-BH en-US
Arabic (Algeria) ar-DZ fr-FR
Arabic (Egypt) ar-EG en-US
Arabic (Iraq) ar-IQ en-US
Arabic (Jordan) ar-JO en-US
Arabic (Kuwait) ar-KW en-US
Arabic (Lebanon) ar-LB en-US
Arabic (Libya) ar-LY en-US
Arabic (Morocco) ar-MA fr-FR
Arabic (Oman) ar-OM en-US
Arabic (Qatar) ar-QA en-US
Arabic (Saudi Arabia) ar-SA en-US
Arabic (Syria) ar-SY en-US
Arabic (Tunisia) ar-TN fr-FR
Arabic (Yemen) ar-YE en-US
Assamese as en-US
Assamese (India) as-IN en-US
Bangla bn en-US
Bangla (Bangladesh) bn-BD en-US
Bangla (India) bn-IN en-US
Tibetan bo en-US
Tibetan (PRC) bo-CN en-US
Divehi dv en-US
Divehi (India) dv-MV en-US
Persian fa en-US
Persian (Iran) fa-IR en-US
Gujarati gu en-US
Gujarati (India) gu-IN en-US
Hebrew he en-US
Hebrew (Israel) he-IL en-US
Hindi hi en-US
Hindi (India) hi-IN en-US
Yi ii en-US
Yi (PRC) ii-CN en-US
Inukitut Syllabics iu-Cans en-US
Inukitut Syllabics (Canada) iu-Cans-CA en-US
Khmer km en-US
Khmer (Cambodia) km-KH en-US
Kannada kn en-US
Kannada (India) kn-IN en-US
Konkani kok en-US
Konkani (India) kok-IN en-US
Lao lo en-US
Lao (Lao P.D.R.) lo-LA en-US
Malayalam ml en-US
Malayalam (India) ml-IN en-US
Mohawk moh en-US
Mohawk (Canada) moh-CA en-US
Marathi mr en-US
Marathi (India) mr-IN en-US
Nepali ne en-US
Nepali (Nepal) ne-NP en-US
Norwegian no nb-NO
Odiya or en-US
Odiya (India) or-IN en-US
Punjabi pa en-US
Punjabi (India) pa-IN en-US
Dari prs en-US
Dari (Afghanistan) prs-AF en-US
Pashto ps en-US
Pashto (Afghanistan) ps-AF en-US
Sanskrit sa en-US
Sanskrit (India) sa-IN en-US
Sinhala si en-US
Sinhala (Sri Lanka) si-LK en-US
Syriac syr en-US
Syriac (Syria) syr-SY en-US
Tamil ta en-US
Tamil (India) ta-IN en-US
Telugu te en-US
Telugu (India) te-IN en-US
Thai th en-US
Thai (Thailand) th-Th en-US
Uighur ug en-US
Uighur (PRC) ug-CN en-US
Urdu ur en-US
Urdu (Pakistan) ur-PK en-US
Vietnamese vi en-US
Vietnamese (Vietnam) vi-VN en-US

Your application can use CultureAndRegionInfoBuilder to create a replacement for a culture, and that culture can have a console fallback culture of your choosing.

Applies to