在Inno Setup中以编程方式选择安装语言 [英] Choosing install language programmatically in Inno Setup
问题描述
我正在使用Inno Setup作为程序的安装程序,但是我希望能够为安装程序本身选择默认语言.我知道它会根据系统区域设置(基于我选择支持的语言列表)选择默认语言,但是我想根据自己的规则选择语言.
I'm using Inno Setup as an installer for my program, but I want to be able to choose the default language for the installer itself. I know it chooses default based on system locale (based on a list of languages I've chosen to support), but I would want to select the language according to my rules.
规则是,对于挪威语"和英语"操作系统,我想显示挪威语,而其他所有默认设置为它们自己的.
The rules is that for "Norwegian" and "English" OS, I want to show Norwegian, while all other gets defaulted to their own.
经过大量Google搜索后,我还没有找到答案,这很可能无法完成.但是我也知道Inno Setup的文档非常缺乏,所以我希望也许有人知道一些没有写下来的东西.
After loads of Googling I have not found an answer to this, and it's very possible it just can't be done. But I am also aware that Inno Setup's documentation is rather lacking, so I'm hoping maybe someone knows something which is not written down.
推荐答案
- 通过将
ShowLanguageDialog
设置为no
. - 在
InitializeSetup
事件函数中执行语言决策逻辑" . - 使用
/LANG
开关重新启动安装程序. - Disable the standard language dialog by setting the
ShowLanguageDialog
tono
. - Do your "language decision logic" in
InitializeSetup
event function. - Re-launch the installer with
/LANG
switch.
基本上,您可以使用以下问题中的代码,不同的是,您无需执行自定义语言选择对话框,而是执行决策逻辑".
Inno设置-具有VCL样式的语言选择器
Basically you can use the code from below question, except that instead of presenting a custom language selection dialog, you do your "decision logic".
Inno Setup - Language selector with VCL Styles
尽管琐碎,但为什么不创建一个英语"(c4)( LanguageID
指令设置为$0409
)?
Though for your trivial case, why don't you just create an "English" .isl
(LanguageID
directive set to $0409
) with Norwegian contents?
这篇关于在Inno Setup中以编程方式选择安装语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!