function mGetLanguage:string;
var
mBuf: array[0..255] of char;
begin
GetLocaleInfo(LOCALE_SYSTEM_DEFAULT,LOCALE_ILANGUAGE,mBuf,256);
Result:=StrPas(mBuf);
end;
使用示例:ShowMessage(mGetLanguage)
查看winapi.windows
{$EXTERNALSYM GetLocaleInfo}
function GetLocaleInfo(Locale: LCID; LCType: LCTYPE; lpLCData: LPWSTR; cchData: Integer): Integer; stdcall;
{$EXTERNALSYM GetLocaleInfoA}
function GetLocaleInfoA(Locale: LCID; LCType: LCTYPE; lpLCData: LPSTR; cchData: Integer): Integer; stdcall;
{$EXTERNALSYM GetLocaleInfoW}
function GetLocaleInfoW(Locale: LCID; LCType: LCTYPE; lpLCData: LPWSTR; cchData: Integer): Integer; stdcall;
实际引用GetLocaleInfoW函数
https://docs.microsoft.com/zh-cn/windows/desktop/api/winnls/nf-winnls-getlocaleinfow
GetLocaleInfoW function
- 2018/12/05
- 2 分钟阅读时长
Retrieves information about a locale specified by identifier.
Note For interoperability reasons, the application should prefer the GetLocaleInfoEx function to GetLocaleInfo because Microsoft is migrating toward the use of locale names instead of locale identifiers for new locales. Any application that runs only o