Is there a way to detect the Language of the OS from within a c# class?
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).
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.
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.
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.
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#.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With