JavaJade
JavaJade

Reputation: 199

Propagate selected language to subinstaller with Inno Setup

I have a master Inno Setup installer in which I can choose a language. In the Run section, I launch a sub-installer (also made in Inno Setup).

When the second installer is launched, I would like use the the language chosen in the master installer.

So I pass in parameter the language.

Now, in the Code section I would like get the language in parameter and set it.

MyMainProgram.iss

Filename: "{tmp}\MySubProgram_setup.exe"; StatusMsg: "Installing My Sub Program"; \
    Parameters: "/Language ""{language}"""

In MySubProgram.iss I can have the language with that : {code:GetCommandLineParam|/Language} or language := GetCommandLineParam('Language')

But I don't know how to set the language.
Thanks

Upvotes: 2

Views: 1224

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202594

Assuming that both installers use the standard Inno Setup language mechanism/dialog, just use the /LANG command-line switch (for the child installer) and set it to the value of {language} constant (in the master installer):

[Languages]
Name: "en"; MessagesFile: "compiler:Default.isl"
Name: "de"; MessagesFile: "compiler:Languages\German.isl"

[Run]
Filename: "{tmp}\MySubProgram_setup.exe"; StatusMsg: "Installing My Sub Program"; \
    Parameters: "/LANG={language}"

The subinstaller does not need any additional code. It just need to have the same languages defined:

[Languages]
Name: "en"; MessagesFile: "compiler:Default.isl"
Name: "de"; MessagesFile: "compiler:Languages\German.isl"

German

enter image description here

Upvotes: 3

Related Questions