简体   繁体   English

如何在C / C ++中获取系统语言?

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

How can I get the system language in C/C++? 如何在C / C ++中获取系统语言? Like en_US or en_GB. 像en_US或en_GB一样。

On a POSIX system, it looks like setlocale(LC_CTYPE, NULL); 在POSIX系统上,它看起来像setlocale(LC_CTYPE,NULL); would return the current locale. 将返回当前的语言环境。

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

Dup of Find out the language windows was installed as Dup of 找出安装的语言窗口

In summary - "the Win32 function you want is GetSystemDefaultUILanguage()" (assuming Windows of course) 总结 - “你想要的Win32功能是GetSystemDefaultUILanguage()”(当然假设是Windows)

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. http://www.manpagez.com/man/1/locale/有部分变量列表及其含义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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