目前正在与NSIS合作为我的PC游戏创建一个安装程序,想知道是否有办法(某些默认命令)可以执行以下两项操作:
当他卸载游戏时提示用户确认(我目前正在手动执行此操作(AKA消息框)但我的问题是它总是用英语(我非常希望消息本地化) ,我想知道是否有默认选项提示默认情况下本地化的用户,如安装程序的其余部分。)
要求创建桌面快捷方式(同样,我使用MUI_FINISHPAGE_SHOWREADME_TEXT执行此操作,但我的文本未定位)
如果没有默认的方法,那么在我的安装程序中将这两个句子本地化的最佳方法是什么?
答案 0 :(得分:1)
您可以使用卸载确认页面:
!include MUI2.nsh
...
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE English
您可以使用LangString
s:
!include MUI2.nsh
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_SHOWREADME
!define MUI_FINISHPAGE_SHOWREADME_TEXT "$(FinishDeskLnkCheck)"
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION CreateDeskLnk
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE English
!insertmacro MUI_LANGUAGE Swedish
LangString FinishDeskLnkCheck ${LANG_ENGLISH} "Create Desktop shortcut?"
LangString FinishDeskLnkCheck ${LANG_SWEDISH} "Bork Desktop bork bork?"
Function .onInit
!define MUI_LANGDLL_ALWAYSSHOW
!define MUI_LANGDLL_ALLLANGUAGES
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
; NOTE: Uninstaller langstring names must be prefixed with "un."
LangString ConfirmUninstMsg ${LANG_ENGLISH} "Kill it?"
LangString ConfirmUninstMsg ${LANG_SWEDISH} "Bork it?"
Function TranslateMsgBoxExample
MessageBox MB_YESNO "$(ConfirmUninstMsg)"
FunctionEnd
Function CreateDeskLnk
; CreateShortcut ...
Call TranslateMsgBoxExample
FunctionEnd
MessageBox中按钮上的文本将使用当前用户的UI语言,无法翻译...