Archive: Section selection depending on language


Section selection depending on language
Hi, after searching this forum (maybe not good enough?) I'm still facing this problem:

I've got several sections which are installed depending on the chosen installer language.

Section "Bla ENG" SEC_BLA_ENG
<stuff to install for english language>
SectionEnd

Section "Bla GER" SEC_BLA_GER
<stuff to install for german language>
SectionEnd
(...many more language depending sections...)

I 've written a litte macro for helping me in selecting/unselecting these sections, using Sections.nsh:

# Macro for selecting language specific sections
!macro SELECT_SECTION GERMAN_SECTION_ID ENGLISH_SECTION_ID
StrCmp $LANGUAGE ${LANG_GERMAN} German${GERMAN_SECTION_ID} English${ENGLISH_SECTION_ID}
German${GERMAN_SECTION_ID}:
!insertmacro SelectSection ${GERMAN_SECTION_ID}
!insertmacro UnselectSection ${ENGLISH_SECTION_ID}
Goto done${GERMAN_SECTION_ID}
English${ENGLISH_SECTION_ID}:
!insertmacro SelectSection ${ENGLISH_SECTION_ID}
!insertmacro UnselectSection ${GERMAN_SECTION_ID}
done${GERMAN_SECTION_ID}:
!macroend

In my .onInit, I call the macro like this:
(...)
!insertmacro MUI_LANGDLL_DISPLAY
!insertmacro SELECT_SECTION SEC_BLA_GER SEC_BLA_ENG
!insertmacro SELECT_SECTION SEC_BLA_GER2 SEC_BLA_ENG2
(...)

But...disregarding the chosen language, ALL sections are installed. What am I doing wrong?

Help really appreciated.
Greez
Jens


Hi jdannenb,

have you tried with "one-section.nsi" example in NSIS installations example folder...?
May be this is what you are looking for.


Hi Jens!

You have to treat the section descriptors as constants.


!insertmacro SELECT_SECTION ${SEC_BLA_GER} ${SEC_BLA_ENG}


Have a nice day!

Cheers

Bruno

Hi Bruno, thanks for your reply.
I tried it, but unfortunately to no avail.
I switched over to LogicLib now.

Section "Bla ENG" SEC_BLA_ENG
${If} $LANGUAGE == ${LANG_ENGLISH}
<stuff to install for english language>
${EndIf}
SectionEnd

This works for me. But, I think this has the disadvantage that I am not controlling the language dependencies in a central place like .onInit
Well never mind, it's working and I won't get fired ;)

Greez
Jens


Hi Jens!

This works for me. You might try this as well...

Have a nice day!

Tschuess!

Bruno


Gruezi Bruno :)
Excellent, thank you :)

Greez
Jens