Choosing install language programmatically in Inno Setup

 ̄綄美尐妖づ 提交于 2020-06-13 08:11:32

问题


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.

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.


回答1:


  • Disable the standard language dialog by setting the ShowLanguageDialog to no.
  • Do your "language decision logic" in InitializeSetup event function.
  • Re-launch the installer with /LANG switch.

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


Though for your trivial case, why don't you just create an "English" .isl (LanguageID directive set to $0409) with Norwegian contents?




回答2:


[Setup]
LanguageDetectionMethod=none

Setup will use the first language specified in the [Languages] section as the default language.



来源:https://stackoverflow.com/questions/49940836/choosing-install-language-programmatically-in-inno-setup

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!