Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect selected language in Inno Setup [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

like image 897
alfreire Avatar asked Oct 26 '25 14:10

alfreire


1 Answers

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;
like image 105
Martin Prikryl Avatar answered Oct 29 '25 05:10

Martin Prikryl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!