简体   繁体   中英

Inno Setup Detect selected language in [Code]

I want to download file with IDP plugin, but I need to choose the file in function of language. Example: installing in English and Spanish and the files are myfile_x86_eng.exe and myfile_x86_spa.exe . I don't know nothing about Pascal and I've searched the internet and Stack Overflow without finding results.

I need something like this:

#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;

Other way can be make a language variable like this myfile_x86_ {lang} .exe or something similar

Use the 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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM