4

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

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
alfreire
  • 99
  • 1
  • 7

1 Answers1

6

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;
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992