简体   繁体   English

如何将所选语言用于卸载程序?

[英]How I can use selected language for uninstaller?

I have my .nsi with this configuration: 我的.nsi具有以下配置:

#########################################################################
## Language Selection Dialog Settings

## Remember the installer language
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
!define MUI_LANGDLL_REGISTRY_KEY "Software\${APP_COMPANY}\${APP_PRODUCT}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"

## Languages (first language is the default language)
!insertmacro MUI_LANGUAGE "Portuguese"
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_LANGUAGE "Spanish"
!insertmacro MUI_LANGUAGE "Dutch"


## Language selection functions (for install and uninstall)
Function .onInit
  !insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd

## Uninstaller Functions
Function un.onInit
   !insertmacro MUI_UNGETLANGUAGE
FunctionEnd

But when I try to uninstall the uninstaller shows me the language dialog everytime. 但是当我尝试卸载时,卸载程序每次都会显示语言对话框。

I follow the MUI2 README and I don't know what I'm doing wrong. 我遵循MUI2自述文件,但我不知道自己在做什么错。

The registry value specified by MUI_LANGDLL_REGISTRY_* is saved automatically by MUI on the MUI_PAGE_INSTFILES page. MUI_LANGDLL_REGISTRY_ *指定的注册表值由MUI自动保存在MUI_PAGE_INSTFILES页面上。 If you are not using this page then you can call the MUI_LANGDLL_SAVELANGUAGE macro yourself or manually write the value of $LANGUAGE. 如果您不使用此页面,则可以自己调用MUI_LANGDLL_SAVELANGUAGE宏,也可以手动编写$ LANGUAGE的值。

I would recommend just using the MUI_PAGE_INSTFILES page so everything is taken care of for you: 我建议您只使用MUI_PAGE_INSTFILES页面,以便一切为您服务:

!define APP_COMPANY "Foo"
!define APP_PRODUCT "Bar"
!include MUI2.nsh
InstallDir "$Temp\Test"
RequestExecutionLevel user

#########################################################################
## Language Selection Dialog Settings

## Remember the installer language
!define MUI_LANGDLL_REGISTRY_ROOT HKCU
!define MUI_LANGDLL_REGISTRY_KEY "Software\${APP_COMPANY}\${APP_PRODUCT}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES


## Languages (first language is the default language)
!insertmacro MUI_LANGUAGE "Portuguese"
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_LANGUAGE "Spanish"
!insertmacro MUI_LANGUAGE "Dutch"


## Language selection functions (for install and uninstall)
Function .onInit
  !insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd

## Uninstaller Functions
Function un.onInit
   !insertmacro MUI_UNGETLANGUAGE
FunctionEnd

Section
SetOutPath $InstDir
WriteUninstaller "$InstDir\Uninst.exe"
SectionEnd

Section Uninstall
DeleteRegKey HKCU "Software\${APP_COMPANY}\${APP_PRODUCT}"
DeleteRegKey /IfEmpty HKCU "Software\${APP_COMPANY}"
Delete "$InstDir\Uninst.exe"
RMDir $InstDir
SectionEnd

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 NSIS 为卸载程序使用选定的语言 - NSIS Use selected language for uninstaller 如何使用所选图像更新显示的对话框图像视图? - How can I update shown dialog imageview with selected image? 如何在listdialog的click事件中获取选定的项目? - How can I get selected items on listdialog's click event? 如何以编程方式确保用户已使用AlertDialog.Builder选择了一个选项? - How can I programmatically make sure a user has selected an option with AlertDialog.Builder? 如何获取用户在 TimePicker 和 DatePicker 中选择的时间和日期? - How can I get time and date which is selected by user in TimePicker and DatePicker? 我该如何回声“很好”和“为什么不呢?” 是否分别选择“是”和“否”? - How can I make it echo 'That's good' and 'Why not?' if 'Yes' and 'No' are selected respectively? 如何从我的列表视图项上的警报对话框(单选)中设置选定的值? - how can i set selected value from alert dialog (single selection) on my list view item? 如何使用Bootstrap Modal对话框并获取返回值? - How I can use a Bootstrap Modal Dialog and get the return values? 如何在F#中使用WPF菜单和对话框? - How can I use WPF menus and dialog boxes in F#? 如何改进我对 Android SharedPreference 的使用? - How can I improve my use of Android SharedPreference?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM