coco_vc
31st July 2007 14:15 UTC
LangDLL, NSIS:Language and /S switch
Hi all,
I had in my script support for multiple languages. Later on, my company decided that for now we support english only. Because I know for a fact that this will get change to support multi-language again, I left the language-code into the script, and I just commented out the following lines:
;!insertmacro MUI_LANGUAGE "French"
...
Function .onInit
;!insertmacro MUI_LANGDLL_DISPLAY
...
FunctionEnd
Everything seems to work fine, english is by default used in the installer and uninstaller, no language dialog is shown. But there is one problem: if I install silently (my-setup.exe /S) the "NSIS:Language" entry is NOT written in the registry, which means that when I later uninstall the program from Add/Remove programs, I get the choose-language-dialog, which is not desired. (The "NSIS:Language" is written into the registry if the installer is run non-silent)
Questions:
a) Why in a silent install the NSIS:Language is not written into the registry? Is this by design? I mean, in a non-silent install, even if the language-dialog is not shown, the NSIS:Language is written into the registry with the default value.
b) How could I solve my problem without removing my language code from the script?
Thank you,
Viv
Afrow UK
31st July 2007 14:36 UTC
The MUI_LANGDLL_SAVELANGUAGE macro is inserted in the InstFiles page leave function, so you should put !insertmacro MUI_LANGDLL_SAVELANGUAGE somewhere where it shall be called in a silent install (like a hidden section).
Stu
coco_vc
31st July 2007 15:21 UTC
Hi Stu,
Thx for your answer.
a) Are you saying that the language is not saved because the "InstFiles page leave function" is not called in a silent install?
b) I could put the !insertmacro MUI_LANGDLL_SAVELANGUAGE into the Main section at the end of it, in case of IfSilent, no?
c) btw, is this problem a bug of MUI, or I'm just using it inadequately?
Thx,
Viv
Afrow UK
31st July 2007 18:00 UTC
It is a common mistake to think that a page leave function is executed in a silent install. Of course, it isn't, because the page itself is never displayed.
Using IfSilent or ${If} ${Silent} with that in a hidden/unselectable section is the way to go.
Stu
coco_vc
1st August 2007 12:48 UTC
Hi Stu,
Originally posted by Afrow UK
It is a common mistake to think that a page leave function is executed in a silent install. Of course, it isn't, because the page itself is never displayed.
Yes, this is clear. What it's not clear, is: shouldn't this somehow be already supported in MUI? I mean MUI_LANGDLL_SAVELANGUAGE is not even documented, so it shouldn't be the user's job to call it specially in a silent install. So, it's either a MUI bug, or I'm misusing something.
Thx,
Viv
Afrow UK
1st August 2007 13:10 UTC
Logically if you install silently, you don't select a language? How can it save a language then?
Stu
coco_vc
2nd August 2007 11:16 UTC
Yes, I agree, but on the other hand no language is selected also when the !insertmacro MUI_LANGDLL_DISPLAY is commented out, like in my case, and still in that case a language is saved in a non-silent mode.
Viv
Afrow UK
2nd August 2007 11:56 UTC
Yes but my point is if you installed silently originally, you would have never selected a language so the uninstaller has to display the dialog.
Stu
coco_vc
3rd August 2007 10:05 UTC
Got it! Thx!
Viv