Skip to content
⌘ NSIS Forum Archive

Extract files based on installer language

7 posts

alecs26#

Extract files based on installer language

Hello,

I use NSIS to install my application on Windows. Then, a license manager is used. By default, this license manager shows options (ex. evaluate, buy) in English. The license manager has different files for each language in separate folders. For instance I have the file app1.xml in folder "English" and the same app1.xml in folder "French".

At installation, with NSIS, the user selects a language (either English or French for now). With that information, I would like to copy either app1.xml from the "English" folder or from the "French" folder to the ".exe" folder.

Is that possible ? How can I do this ?

Thank you very much,

Alex
alecs26#
Perfect thank you very much.
I'm just unsure as to what to do next.

In the section where I copy files, for instance:
Section "MainSection" SEC01
SetOutPath "$INSTDIR"
File "..\..\AssystMouse\English\app1.xml"
How can I choose the folder ?
Something like
if $language==1
File "..\..\AssystMouse\French\app1.xml"
?

Would you have an example ?

Thank you so much !
Anders#
Something like this

!include LogicLib.nsh
Section
SetOutPath $InstDir
${If} $Language = 1033 ; Can also use ${LANG_ENGLISH}
File "English.txt"
${Else}
File "French.txt"
${EndIf}
SectionEnd
alecs26#
Thank you so much ! It works !!

Is it possible that it works without !include LogicLib.nsh ?
I didn't use it by mistake and it worked. Should I still include it just in case ?

Thank you so much again !

Alex
Nutzzz#
If it worked without it, then LogicLib.nsh was already !include'd elsewhere, otherwise the "${If}", etc. macros would not have been defined. LogicLib sets up defines so it won't try to load itself twice, so it's best to !include it in your main .nsi file, since if you stopped using whatever header file that had the "!include LogicLib.nsh" in it, then those macros would break.