Localization NSIS不正确地使用LangString

Localization NSIS不正确地使用LangString,localization,nsis,Localization,Nsis,我有一个安装程序,它使用NSIS命令行功能自动(在TFS上)构建 "..\..\NSIS\makensis.exe" /DBUILD_NUMBER=28311 /DPRODUCT_LANGUAGE=English "MTService_setup.nsi" 安装程序必须使用PRODUCT_language参数中指定的语言。我是这样做的 !insertmacro MUI_LANGUAGE "${PRODUCT_LANGUAGE}" 当我以这种方式构建安装程序时,接口的公共语言是正确的。但它使

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

"..\..\NSIS\makensis.exe"  /DBUILD_NUMBER=28311 /DPRODUCT_LANGUAGE=English "MTService_setup.nsi"
安装程序必须使用PRODUCT_language参数中指定的语言。我是这样做的

!insertmacro MUI_LANGUAGE "${PRODUCT_LANGUAGE}"
当我以这种方式构建安装程序时,接口的公共语言是正确的。但它使用默认的系统语言来表示LangString。因此,如果默认系统语言不是英语,它会在英语安装程序中显示另一种语言的LangString

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

它也不起作用

我已尝试将脚本更改为

!!插入宏MUI_语言“英语” !插入语“俄语”

函数。onInit

!!插入宏MUI_LANGDLL_显示

功能端

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

那么,我该如何修复它呢


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

下面是一个基于中代码的工作示例:


是的,所有语言都必须用MUI_语言指定(不仅当前${PRODUCT_语言}-!insertmacro MUI_语言“${PRODUCT_语言}”不正确)。但是在onInit中,我可以从命令行StrCpy$LANGUAGE“${PRODUCT\u LANGUAGE}”中获取值
!insertmacro MUI_LANGUAGE "English"
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