This documentation is archived and is not being maintained.

CultureInfo.GetConsoleFallbackUICulture Method

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

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

[ComVisibleAttribute(false)]
public CultureInfo GetConsoleFallbackUICulture()

Return Value

Type: System.Globalization.CultureInfo
An alternate neutral culture that is used to read and display text on the console.

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 neutral 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 CurrentUICulture Property" subtopic of the Using the CurrentUICulture Property topic.

The following are predefined cultures that have a different fallback user interface culture name from the predefined culture name. The list is complete as of the initial release of .NET Framework 2.0.

Predefined culture

Culture name

Fallback user interface culture name

(neutral Arabic)

ar

en

Arabic (Algeria)

ar-DZ

fr

Arabic (Bahrain)

ar-BH

en

Arabic (Egypt)

ar-EG

en

Arabic (Iraq)

ar-IQ

en

Arabic (Jordan)

ar-JO

en

Arabic (Kuwait)

ar-KW

en

Arabic (Lebanon)

ar-LB

en

Arabic (Libya)

ar-LY

en

Arabic (Morocco)

ar-MA

fr

Arabic (Oman)

ar-OM

en

Arabic (Qatar)

ar-QA

en

Arabic (Saudi Arabia)

ar-SA

en

Arabic (Syria)

ar-SY

en

Arabic (Tunisia)

ar-TN

fr

Arabic (U.A.E.)

ar-AE

en

Arabic (Yemen)

ar-YE

en

Divehi

dv

en

Divehi (India)

dv-MV

en

Persian

fa

en

Persian (Iran)

fa-IR

en

Gujarati

gu

en

Gujarati (India)

gu-IN

en

Hebrew

he

en

Hebrew (Israel)

he-IL

en

Hindi

hi

en

Hindi (India)

hi-IN

en

Kannada

kn

en

Kannada (India)

kn-IN

en

Konkani

kok

en

Konkani (India)

kok-IN

en

Marathi

mr

en

Marathi (India)

mr-IN

en

Punjabi

pa

en

Punjabi (India)

pa-IN

en

Sanskrit

sa

en

Sanskrit (India)

sa-IN

en

Syriac

syr

en

Syriac (Syria)

syr-SY

en

Tamil

ta

en

Tamil (India)

ta-IN

en

Telugu

te

en

Telugu (India)

te-IN

en

Thai

th

en

Thai (Thailand)

th-Th

en

Urdu

ur

en

Urdu (Pakistan)

ur-PK

en

Vietnamese

vi

en

Vietnamese (Vietnam)

vi-VN

en

For cultures that have WindowsOnlyCultures set in CultureTypes, the console fallback culture is always the invariant culture, InvariantCulture, and this cannot be changed. However, your application can use CultureAndRegionInfoBuilder to create a replacement for this culture, and that culture can have a console fallback culture of your choosing.

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

// 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

*/

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

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

.NET Framework

Supported in: 3.5, 3.0, 2.0
Show: