How can I get the system language in C/C++? Like en_US or en_GB.
Dup of http://stackoverflow.com/questions/953416/find-out-the-language-windows-was-installed-as
In summary - "the Win32 function you want is GetSystemDefaultUILanguage()" (assuming Windows of course)
On a POSIX system, it looks like setlocale(LC_CTYPE, NULL); would return the current locale.
C++, as a language has no such facilities.
It's OS dependant.
Edit:
Sorry... I wasn't aware of std::locale. It is good to learn new things.
Generally you don't -- rather, you (usually) want to just conform to what it asks for using the nameless locale (i.e., std::locale("");
will give you the locale of the user's choosing).
There isn't necessarily one system language; individual "facets" of the locale can be configured separately. It's all done with environment variables; http://www.manpagez.com/man/1/locale/ has a partial list of variables and their meanings.