|
|
#1 |
|
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) |
|
|
|
|
|
#2 |
|
Senior Member
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 |
|
|
|
|
|
#3 |
|
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}.
|
|
|
|
|
|
#4 |
|
Moderator
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 |
|
|
|
|
|
#5 |
|
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} |
|
|
|
|
|
#6 |
|
Senior Member
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 |
|
|
|
|
|
#7 |
|
Moderator
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 |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|