在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
LoadLangFromStrings http://docwiki.embarcadero.com/Libraries/Berlin/en/FMX.Types.TLang http://blog.csdn.net/pcplayer/article/details/78152471 procedure TForm7.Button1Click(Sender: TObject); var list: TStringList; begin list := TStringList.Create; list.LoadFromFile('cn.txt'); LoadLangFromStrings(list); list.Free; end; procedure TForm7.Button2Click(Sender: TObject); var list: TStringList; begin list := TStringList.Create; list.LoadFromFile('en.txt'); LoadLangFromStrings(list); list.Free; end; cn.txt Button1=开始
en.txt Button1=start
//没找到下文的出处和原作者。暂时记录. // uses FMX.Platform{$IFDEF MSWINDOWS}, WinAPi.Windows{$ENDIF}; {$R *.fmx} // 以下这个函数,获取当前操作系统的语言设置。 比如 Windows 底下,语言为中文,返回 Zh // 这个函数支持各种操作系统。 end; function GetOSLangID: String; {$IFDEF MACOS}var Languages: NSArray; begin Languages := TNSLocale.OCClass.preferredLanguages; Result := TNSString.Wrap(Languages.objectAtIndex(0)).UTF8String; {$ENDIF}{$IFDEF ANDROID}var LocServ: IFMXLocaleService; begin if TPlatformServices.Current.SupportsPlatformService(IFMXLocaleService, IInterface(LocServ)) then Result := LocServ.GetCurrentLangID; {$ENDIF}{$IFDEF MSWINDOWS}var buffer: MarshaledString; UserLCID: LCID; BufLen: Integer; begin // defaults UserLCID := GetUserDefaultLCID; BufLen := GetLocaleInfo(UserLCID, LOCALE_SISO639LANGNAME, nil, 0); buffer := StrAlloc(BufLen); if GetLocaleInfo(UserLCID, LOCALE_SISO639LANGNAME, buffer, BufLen) <> 0 then Result := buffer else Result := 'en'; StrDispose(buffer); {$ENDIF} end;
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论