简体   繁体   中英

How can I get the system language in C/C++?

How can I get the system language in C/C++? Like en_US or en_GB.

On a POSIX system, it looks like setlocale(LC_CTYPE, NULL); would return the current locale.

通常你不会 - 而是你(通常)只想符合它要求使用无名语言环境(即std::locale("");将为你提供用户选择的语言环境)。

Dup of Find out the language windows was installed as

In summary - "the Win32 function you want is GetSystemDefaultUILanguage()" (assuming Windows of course)

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM