我使用以下English.nsh文件中的代码片段自定义了目录目标文件夹文本
!define MUI_TEXT_DIRECTORY_TITLE "Destination Folder"
!define MUI_TEXT_DIRECTORY_SUBTITLE "Click Install to install to the default folder or click Browse to choose another"
使用上面的代码,它两次显示“目标文件夹”。
如下所示
但是我需要将显示为“目标文件夹”的突出显示文本更改为“将EMR安装到:”
此处的标题应与显示的样子一样(“目标文件夹”)
如何将突出显示的文本(“目标文件夹”)设置为其他文本(“将EMR安装到:”)?
我点击了以下链接以解决此问题,即使如此,我仍然两次收到“目标文件夹”文本。
Change the text of install folder page in NSIS
下面是我的完整代码:
CustomEngilish.nsh
!define MUI_TEXT_DIRECTORY_TITLE "Destination Folder"
!define MUI_TEXT_DIRECTORY_SUBTITLE "Click Install to install to the default folder or click Browse to choose another"
!define MUI_DIRECTORYPAGE_TEXT_TOP "Install EMR to:"
!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Install EMR to:"
!insertmacro MUI_LANGUAGE "English"
Mysetup.nsi
!define MUI_PAGE_CUSTOMFUNCTION_SHOW MyDirectoryShowCallback
!insertmacro MUI_PAGE_DIRECTORY
!include "CustomEnglish.nsh"
Function MyDirectoryShowCallback
StrCpy $PageId 3
SendMessage $mui.DirectoryPage.Text ${WM_SETTEXT} 0 "STR:$(MUI_TEXT_DIRECTORY_TITLE)"
SendMessage $mui.DirectoryPage.Text ${WM_SETTEXT} 0 "STR:$(MUI_TEXT_DIRECTORY_SUBTITLE)"
SendMessage $mui.DirectoryPage.Text ${WM_SETTEXT} 0 "STR:$(MUI_DIRECTORYPAGE_TEXT_TOP)"
SendMessage $mui.DirectoryPage.Text ${WM_SETTEXT} 0 "STR:$(MUI_DIRECTORYPAGE_TEXT_DESTINATION)"
FunctionEnd
答案 0 :(得分:1)
MUI_TEXT_DIRECTORY_TITLE
是顶部标题中的文本,您需要MUI_DIRECTORYPAGE_TEXT_TOP
,并且在使用多种语言时需要指向自定义语言字符串:
!include "MUI2.nsh"
!insertmacro MUI_PAGE_WELCOME
!define MUI_DIRECTORYPAGE_TEXT_TOP $(mydirtoptext)
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
; CustomSwedish.nsh:
!insertmacro MUI_LANGUAGE "Swedish"
LangString mydirtoptext ${LANG_SWEDISH} "Swedish bork bork"
; CustomEnglish.nsh:
!insertmacro MUI_LANGUAGE "English"
LangString mydirtoptext ${LANG_ENGLISH} "English blah blah"
在屏幕截图中,顶部区域为灰色,但通常应为白色,这通常表示MUI_PAGE和MUI_LANGUAGE宏的顺序存在问题。所有语言都必须在页面之后。