0

我有一个安装程序,它使用 NSIS 命令行功能自动构建(在 TFS 上)

"..\..\NSIS\makensis.exe"  /DBUILD_NUMBER=28311 /DPRODUCT_LANGUAGE=English "MTService_setup.nsi"

安装程序必须使用 PRODUCT_LANGUAGE 参数中指定的语言。我已经通过以下方式完成了

!insertmacro MUI_LANGUAGE "${PRODUCT_LANGUAGE}"

当我以这种方式构建安装程序时,界面的通用语言是正确的。但它对 LangString 使用默认系统语言。因此,如果默认系统语言不是英语,它会在英语安装程序中以另一种语言显示 LangString。

我试图更改脚本以避免命令行参数(用于测试目的)

!insertmacro MUI_LANGUAGE "English"

它也不起作用。

我试图将脚本更改为

!insertmacro MUI_LANGUAGE "英语" !insertmacro MUI_LANGUAGE "俄语"

函数 .onInit

!insertmacro MUI_LANGDLL_DISPLAY

功能结束

它可以工作,但是,当然,它会显示语言选择对话框。我想在没有任何对话框的情况下使用特定的 ${PRODUCT_LANGUAGE}。

那么,我该如何解决呢?

例子

4

1 回答 1

1

您没有在示例中向我们展示您的 LangString 代码,因此很难说出问题所在!

这是一个基于MUI 自述文件中代码的工作示例:

Outfile "test.exe"
Requestexecutionlevel user

!include MUI2.nsh
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE Swedish ;First language is the default if a better match is not found
!insertmacro MUI_LANGUAGE Danish

Function .onInit
StrCpy $language ${LANG_DANISH} ;Always force Danish?
FunctionEnd

Section "Section Name 1" Section1
SectionEnd
Section "Section Name 2" Section2
SectionEnd

LangString DESC_Section1 ${LANG_SWEDISH} "Bork, bork, bork!"
LangString DESC_Section2 ${LANG_SWEDISH} "Aweenda shmure da froog's legs."
LangString DESC_Section1 ${LANG_DANISH} "Danish text here for section 1"
LangString DESC_Section2 ${LANG_DANISH} "...and section 2"
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
    !insertmacro MUI_DESCRIPTION_TEXT ${Section1} $(DESC_Section1)
    !insertmacro MUI_DESCRIPTION_TEXT ${Section2} $(DESC_Section2)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
于 2012-08-24T23:09:10.887 回答