Old 14th December 2017, 14:39   #1
alecs26
Junior Member
 
Join Date: Apr 2017
Posts: 10
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 is offline   Reply With Quote
Old 14th December 2017, 14:57   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,644
The chosen Windows language id is stored in the $language variable.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 14th December 2017, 15:06   #3
alecs26
Junior Member
 
Join Date: Apr 2017
Posts: 10
Perfect thank you very much.
I'm just unsure as to what to do next.

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

Would you have an example ?

Thank you so much !
alecs26 is offline   Reply With Quote
Old 14th December 2017, 17:52   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,644
Something like this

Quote:
!include LogicLib.nsh
Section
SetOutPath $InstDir
${If} $Language = 1033 ; Can also use ${LANG_ENGLISH}
File "English.txt"
${Else}
File "French.txt"
${EndIf}
SectionEnd

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 14th December 2017, 19:48   #5
alecs26
Junior Member
 
Join Date: Apr 2017
Posts: 10
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
alecs26 is offline   Reply With Quote
Old 14th December 2017, 20:15   #6
Nutzzz
Junior Member
 
Join Date: May 2007
Location: Orange County, CA, U.S.A.
Posts: 25
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.
Nutzzz is offline   Reply With Quote
Old 14th December 2017, 20:19   #7
alecs26
Junior Member
 
Join Date: Apr 2017
Posts: 10
Perfect, thank you so much again for your help !!
alecs26 is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump