System Locale: en-us;English (United States)
Input Locale: en-us;English (United States)
当您运行 systeminfo.exe 时,有用的信息包括上述两行。Windows API 或 C 运行时函数是否提供字符串English (United States)?
它可以与GetLocaleInfo
. LCTYPE 是 LOCALE_SENGLANGUAGE / LOCALE_SENGCOUNTRY,我猜。
#include <windows.h>
#include <stdio.h>
int
main() {
char language[256] = {0}, country[256] = {0};
GetLocaleInfo(
GetUserDefaultLCID(),
LOCALE_SENGLANGUAGE,
language,
sizeof(language));
GetLocaleInfo(
GetUserDefaultLCID(),
LOCALE_SENGCOUNTRY,
country,
sizeof(country));
printf("%s (%s)\n", language, country);
}
// I got "Japanese (Japan)"