简体   繁体   中英

NSIS Use selected language for uninstaller

I am working on NSIS installer and I just added multi language to the installer. I wanted the Installer to show the language dialog everytime the user click on the installer, so I removed those two lines from my nsi file

!define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"

this one also force the uninstaller to show the language dialog everytime the user click on it.

I would like to disable the language dialog in the installer OR to make it use the language the user selected when installed the program << this way is better.

Thanks for the helpers.

You can save the $language variable in the registry during install and read it into $language in un.onInit. If you don't want to display the language dialog, don't call it in .onInit

Use this:

Function un.onInit

  !insertmacro MUI_UNGETLANGUAGE
  
FunctionEnd

You need to have MUI_LANGDLL_REGISTRY_* setup as well like this:

!define MUI_LANGDLL_REGISTRY_ROOT "HKCU" 
!define MUI_LANGDLL_REGISTRY_KEY "Software\YourAppName" 
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM