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

时间:2021-08-26 04:54:43

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

如何在C / C ++中获取系统语言?像en_US或en_GB。

4 个解决方案

#1


9  

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

在POSIX系统上,它看起来像setlocale(LC_CTYPE,NULL);将返回当前的区域设置。

#2


6  

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).

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

#3


5  

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)

#4


0  

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/有部分变量列表及其含义。

#1


9  

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

在POSIX系统上,它看起来像setlocale(LC_CTYPE,NULL);将返回当前的区域设置。

#2


6  

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).

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

#3


5  

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)

#4


0  

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/有部分变量列表及其含义。