FASTSCRIPT脚本实现多国语言

uses 

fs_ipascal, fs_iformsrtti,
fs_iinterpreter

 

 

主程序装载脚本

procedure TForm1.FormCreate(Sender: TObject);

begin

  fsScript1.Clear;

  fsScript1.Parent := fsGlobalUnit;

  fsScript1.AddComponent(Form1);

  fsScript1.Lines.LoadFromFile('1.txt');

  fsScript1.Run;

end;

 

1.txt文件

uses 'lang.txt'; //引用公用的语言单元

 

procedure button1click(sender: tobject);

begin

  showmessage('hello');

end;

 

begin

  with form1 do

  begin

    button1.caption := const_append;

    button2.caption := const_save;

    button1.onclick := @button1click;

  end;

end.

 

Lang.txt公用的语言单元

const

  const_append = '增加';

  const_save = '保存';

 

begin

 

end.

 

使用不同lang.txt文件来对应不同的语言即可。

posted @   delphi中间件  阅读(1337)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示