开发者

Conditional install based on language with 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 la开发者_如何学Pythonnguage 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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜