Inno Setup在[Code]中检测选定的语言

时间:2017-02-17 20:07:40

标签: inno-setup

我想用IDP插件下载文件,但我需要选择语言功能的文件。示例:使用英语和西班牙语安装,文件为myfile_x86_eng.exemyfile_x86_spa.exe。 我对Pascal一无所知,我在没有找到结果的情况下搜索了互联网和Stack Overflow。

我需要这样的东西:

#include ". \ Idp.iss"

[Languages]
Name: "English"; MessagesFile: "compiler: Languages \ English.isl";
Name: "Spanish"; MessagesFile: "compiler: Languages \ Spanish.isl";

[Code]
Procedure InitializeWizard (): string;
Var
  Language: string;
Begin
  Language: = ExpandConstant ('{param: LANG}');
  If Language = 'English' then
  Begin
    IdpAddFile ('https://myweb.com/myfile_x86_eng.exe', ExpandConstant ('{tmp} \ myfile_x86_eng.exe'));
  End
    Else
  If Language = 'Spanish' then
  Begin
    IdpAddFile ('https://myweb.com/myfile_x86_esp.exe', ExpandConstant ('{tmp} \ myfile_x86_spa.exe'));
  End;
End;

其他方式可以是制作像myfile_x86_ {lang} .exe或类似的

这样的语言变量

1 个答案:

答案 0 :(得分:2)

使用ActiveLanguage function

if ActiveLanguage = 'English' then
begin
  IdpAddFile('https://www.example.com/myfile_x86_eng.exe',
             ExpandConstant('{tmp}\myfile_x86_eng.exe'));
end
  else
if ActiveLanguage = 'Spanish' then
begin
  IdpAddFile('https://www.example.com/myfile_x86_esp.exe', 
             ExpandConstant('{tmp}\myfile_x86_spa.exe'));
end;