Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 18th March 2011, 14:01   #1
araucano2010
Junior Member
 
Join Date: Mar 2011
Posts: 2
Language-dependent shortcuts

Hi,

I'd like to create different shortcuts based on the selected language. Here's the code I'd like to use, but it's not working:

${If} ${LANGUAGE} == ${LANG_ENGLISH}
CreateShortCut "$DESKTOP\MyProgram.lnk" "$INSTDIR\MyProgram.exe" "1"
${ElseIf} ${LANGUAGE} == ${LANG_SPANISHINTERNATIONAL}
CreateShortCut "$DESKTOP\MyProgram.lnk" "$INSTDIR\MyProgram.exe" "2"
${Else}
CreateShortCut "$DESKTOP\MyProgram.lnk" "$INSTDIR\MyProgram.exe" "3"
${EndIf}

It always create the shortcut with the "3" parameter (I guess there's something wrong in the If clause, but I cannot figure it out)
araucano2010 is offline   Reply With Quote
Old 18th March 2011, 14:27   #2
jiake
Senior Member
 
jiake's Avatar
 
Join Date: Oct 2007
Location: Xi'an, China
Posts: 194
Replace == with =, and ${LANG_ENGLISH} with 1033, and then try again.

An NSIS fan from China, my name is Jia Ke (pinyin).
Email: jiake@vip.qq.com
Messenger: jiake@live.in
QQ (Chinese IM): 550771955
jiake is offline   Reply With Quote
Old 18th March 2011, 14:46   #3
demiller9
Senior Member
 
Join Date: Mar 2006
Location: Dallas
Posts: 442
You are testing at run-time, you should be examining the variable $LANGUAGE, not a define set at compile-time called ${LANGUAGE}.
demiller9 is offline   Reply With Quote
Old 18th March 2011, 15:10   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
And it is perfectly fine to use ${LANG_ENGLISH} and == should work fine (it uses StrCmp).

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 18th March 2011, 19:18   #5
araucano2010
Junior Member
 
Join Date: Mar 2011
Posts: 2
Thanks a lot It works like a charm like this:

${If} $LANGUAGE == ${LANG_ENGLISH}
CreateShortCut "$DESKTOP\MyProgram.lnk" "$INSTDIR\MyProgram.exe" "1"
${ElseIf} $LANGUAGE == ${LANG_SPANISHINTERNATIONAL}
CreateShortCut "$DESKTOP\MyProgram.lnk" "$INSTDIR\MyProgram.exe" "2"
${Else}
CreateShortCut "$DESKTOP\MyProgram.lnk" "$INSTDIR\MyProgram.exe" "3"
${EndIf}
araucano2010 is offline   Reply With Quote
Old 18th March 2011, 21:56   #6
jiake
Senior Member
 
jiake's Avatar
 
Join Date: Oct 2007
Location: Xi'an, China
Posts: 194
I unexpectedly didn't find his error - ${LANGUAGE}. For comparation of pure numerical string, I prefer to use IntCmp not StrCmp. I suggest to replace ${LANG_ENGLISH} with 1033, for that I really met this problem before: LangString STRNAME ${LANG_ENGLISH} ... does not work, but: LangString STRNAME 1033 ... works, I even thought whether NSIS has discarded these constants.

An NSIS fan from China, my name is Jia Ke (pinyin).
Email: jiake@vip.qq.com
Messenger: jiake@live.in
QQ (Chinese IM): 550771955
jiake is offline   Reply With Quote
Old 19th March 2011, 17:34   #7
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
The LANG_ defines work fine for me. You just need to use them after they are defined - i.e. after where you've included the language.

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp 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