If already installed, there should be a language id in the registry. We can use "!insertmacro MUI_UNGETLANGUAGE" in un.onInit function. But how to set the right language in .onInit function?
I want to display a messagebox in .onInit function to confirm uninstall if it's already installed. Of course, I want the messagebox in multi-language like:
MessageBox MB_OKCANCEL|MB_ICONQUESTION|MB_DEFBUTTON2 "$(UninstallConfirm)" IDOK uninst
But how to set the right language? MUI_UNGETLANGUAGE has no effect in .onInit function. And I try to use StrCpy set $LANGUAGE var and there was also no effect.
How to set language in .onInit function?
6 posts
If you're using MUI_UNGETLANGUAGE, I presume you're also using..
Instead of letting MUI read the value, you could read it yourself.
However, MUI should already be using the language stored in that registry key automatically... if it doesn't for that messagebox at .onInit, then I suppose you will indeed have to go with manually reading out the value and applying the appropriate language before the messagebox is displayed.
In the installer to store that setting.
MUI_LANGDLL_REGISTRY_ROOT root
MUI_LANGDLL_REGISTRY_KEY key
MUI_LANGDLL_REGISTRY_VALUENAME value_name
Instead of letting MUI read the value, you could read it yourself.
However, MUI should already be using the language stored in that registry key automatically... if it doesn't for that messagebox at .onInit, then I suppose you will indeed have to go with manually reading out the value and applying the appropriate language before the messagebox is displayed.
from the helpfile
If you change the language in the .onInit function, note that language strings in .onInit will still use the detected language based on the user's default Windows language, because the language is initialized after .onInit.you can use .onGuiInit (but why is the uninstall confirm page not enough?)
Thanks for reply.
Yes, I read the language manually but this is not the problem, the problem is even I set the $LANGUAGE, MessageBox also not display the right language:
The uninstall confirm page is displayed when uninstall is processing. But I need to confirm if uninstall when user run install.exe for twice(when he already installed), not run uninstall.exe, thanks.
Yes, I read the language manually but this is not the problem, the problem is even I set the $LANGUAGE, MessageBox also not display the right language:
It's english, and my system is english.
Function .onInit
StrCpy $LANGUAGE ${LANG_SIMPCHINESE}
MessageBox MB_OKCANCEL|MB_ICONQUESTION|MB_DEFBUTTON2 "$(UninstallConfirm)" IDOK uninst
FunctionEnd
The uninstall confirm page is displayed when uninstall is processing. But I need to confirm if uninstall when user run install.exe for twice(when he already installed), not run uninstall.exe, thanks.
Use un.onGUIInit (!define MUI_CUSTOMFUNCTION_UNGUIINIT un.myOnGUIInit). Languages are not initialised until after .onInit.
Stu
Stu
Thanks for all! .onGuiInit and un.onGUIInit is good, I've done, thanks.