问题
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