Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

detect os language from c#

Is there a way to detect the Language of the OS from within a c# class?

like image 607
crauscher Avatar asked Jan 26 '09 10:01

crauscher


People also ask

What is OS in C?

An operating system (OS) is the program that, after being initially loaded into the computer by a boot program, manages all of the other application programs in a computer. The application programs make use of the operating system by making requests for services through a defined application program interface (API).

Is C used for OS?

Most of the operating systems are written in the C/C++ languages. These not only include Windows or Linux (the Linux kernel is almost entirely written in C), but also Google Chrome OS, RIM Blackberry OS 4.

How do I check C system?

Software Engineering C To check the operating system of the host in a C or C++ code, we need to check the macros defined by the compiler (GNU GCC or G++). For example, on Windows platform, the compiler has a special macro named _WIN32 defined. So, if the macro _WIN32 is defined, we are on Windows.

Which language is used to design OS?

C is the programming language most commonly used and recommended for writing operating systems. For this reason, we are going to recommend learning and using C for OS development. However, other languages such as C++ and Python can also be used.


2 Answers

Unfortunately, the previous answers are not 100% correct.

The CurrentCulture is the culture info of the running thread, and it is used for operations that need to know the current culture, but not do display anything. CurrentUICulture is used to format the display, such as correct display of the DateTime. Because you might change the current thread Culture or UICulture, if you want to know what the OS CultureInfo actually is, use CultureInfo.InstalledUICulture.

Also, there is another question about this subject (more recent than this one) with a detailed answer:

Get operating system language in c#.

like image 107
Mihai Drebot Avatar answered Sep 20 '22 17:09

Mihai Drebot


With the System.Globalization.CultureInfo class you can determine what you want.

With CultureInfo.CurrentCulture you get the system set culture, with CultureInfo.CurrentUICulture you get the user set culture.

like image 45
Oliver Friedrich Avatar answered Sep 22 '22 17:09

Oliver Friedrich