NSIS部分在InfoType中基于语言选择可交换

时间:2014-11-13 04:15:08

标签: nsis

希望根据用户选择的语言更改SectionIn。因此,如果“标准”安装为1并且“完全”安装为2,我希望如果用户选择英语,则“英语文档”部分具有SectionIn 1 2,但如果他们选择其他类似法语,则“英语文档“是SectionIn 2,”French Documentation“是SectionIn 1 2。

目标是无论如何都可以选择两种语言文档,但基于语言,默认情况下,InstType下拉框将显示“标准”而不是自定义(我已经知道如何选择一个或者其他基于语言选择)。这基本上是我正在努力改变选择:

    InstType "Standard"
    InstType "Full"

    Section /o "English Docs" English
    SectionIn 2
    ;crap to run
    SectionEnd

    Section /o "French Docs" French
    SectionIn 2
    ;crap to run
    SectionEnd


    Function .onInit
    !insertmacro MUI_LANGDLL_DISPLAY
    ${If} $LANGUAGE == ${LANG_ENGLISH}
    !insertmacro SelectSection ${English}
    ${EndIf}
    ${If} $LANGUAGE == ${LANG_FRENCH}
    !insertmacro SelectSection ${French}
    ${EndIf}
    FunctionEnd

1 个答案:

答案 0 :(得分:0)

使用SectionSetInstTypes:

!include MUI2.nsh
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE English
!insertmacro MUI_LANGUAGE French


InstType "Standard"
InstType "Full"

Section /o "English Docs" SID_English
SectionIn 2
;crap to run
SectionEnd

Section /o "French Docs" SID_French
SectionIn 2
;crap to run
SectionEnd


Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
${If} $LANGUAGE == ${LANG_ENGLISH}
    StrCpy $0 ${SID_English}
${EndIf}
${If} $LANGUAGE == ${LANG_FRENCH}
    StrCpy $0 ${SID_French}
${EndIf}

SectionSetInstTypes $0 3
!insertmacro SelectSection $0
FunctionEnd