uses FMX.Platform;
function TForm2.GetCurrentLan: string;
var
LocServ: IFMXLocaleService;
begin
//读取当前语言,测试通过。
if TPlatformServices.Current.SupportsPlatformService(IFMXLocaleService, IInterface(LocServ)) then
Result := LocServ.GetCurrentLangID;
end;
以上代码,Windows 和 Android 底下测试通过。iOS 想来也不会有问题。

本文介绍了一段用于读取跨平台应用中当前设置语言的 Delphi 代码,并验证了其在 Windows 和 Android 平台上的有效性。
1065

被折叠的 条评论
为什么被折叠?



