Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conditional install based on language with Inno Setup

Tags:

inno-setup

I'm trying to do a conditional install based on the chosen language in Inno Setup.

I.e. if chosen language is english, then install file en.txt, if chosen language is italian, then install file it.txt and so on.

Is it possibile to do it? I've seen that there is a {language} constant, but I don't understand how to use it to do a conditional install.

like image 730
Enrico Detoma Avatar asked Jan 13 '11 22:01

Enrico Detoma


2 Answers

Which file are installed based on language selection is always conditional just by adding the Languages parameter to the [Files] entry.

Common Parameters from Inno Setup Help says:

Languages
A space separated list of language names, telling Setup to which languages the entry belongs. If the end user selects a language from this list, the entry is processed (for example: the file is installed).

An entry without a Languages parameter is always processed, unless other parameters say it shouldn't be.

Besides space separated lists, you may also use boolean expressions. See Components and Tasks parameters for examples of boolean expressions.

Example:
Languages: en nl

So, if you want a file installed only for english and another only for spanish, another for english and spanish (but not for french), the [Files] entry may look like this:

[Files]
Source: "MyProg-en.chm"; DestDir: "{app}"; Languages: en
Source: "MyProg-es.chm"; DestDir: "{app}"; Languages: es
Source: "x.exe"; DestDir: "{app}"; Languages: en es

Take a look at the Languages.iss script included in the inno setup examples folder.

like image 132
jachguate Avatar answered Nov 13 '22 20:11

jachguate


Just one note, works allso for registry section. For example

[Languages]
Name: "en"; MessagesFile: "compiler:Default.isl"
Name: "ger"; MessagesFile: "compiler:Languages\German.isl"
Name: "fr"; MessagesFile: "compiler:Languages\French.isl"

[Registry]
Root: HKCR; Subkey: ".tes"; ValueType: string; ValueName: ""; ValueData: "Testing..."; Languages: fr

intstalls this registry key only if user choose french language for install. It is usefull when you can store language of installed program in registry.

like image 43
Ajax Avatar answered Nov 13 '22 19:11

Ajax