2012-08-24 36 views
0

我有一個安裝程序,它自動地(在TFS)通過使用NSIS命令行構建設有NSIS工作與不正確LangString

"..\..\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

FunctionEnd

它的作品,但當然,它顯示語言選擇對話框。我想在沒有任何對話框的情況下使用特定的$ {PRODUCT_LANGUAGE}。

那麼,我該如何解決它?

Example

回答

1

你沒告訴我們你的LangString代碼在你的榜樣,因此很難說是什麼問題!

這是基於代碼的MUI readme工作示例:

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 
+0

是的,所有的語言必須MUI_LANGUAGE(不僅是當前$ {PRODUCT_LANGUAGE}指定 - insertmacro MUI_LANGUAGE 「$ {PRODUCT_LANGUAGE}」 是不正確的)。 但是在onInit中,我可以從命令行獲取價值 StrCpy $ LANGUAGE「$ {PRODUCT_LANGUAGE}」 –