Archive: Language Problem Again


Language Problem Again
Hi

I put this code in my installer

#--------------------------------
#Installer Functions
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY

System::Call 'kernel32::CreateMutexA(i 0, i 0, t "MiSoftwareSetup") i .r1 ?e'
Pop $R0

StrCmp $R0 0 +3
MessageBox MB_OK|MB_ICONEXCLAMATION ${AlreadyRunning}

Abort
FunctionEnd

#--------------------------------
#Language strings ENGLISH
LangString AlreadyRunning ${LANG_ENGLISH} "The installer is already running!"
LangString AlreadyRunning ${LANG_SPANISH} "El instalador ya se esta ejecutando!"
#--------------------------------


But when I run the installer twice and select Other Language, it doesnt work, always show me in English
Whats Happend?


First it is $(AlreadyRunning) not ${AlreadyRunning}.
Second the message is at .onInit function that's why it shows only english. Either take it .onGuiInit function, or remove langstrings and add messages like this:

StrCmp $R0 0 +6
StrCmp $LANGUAGE ${LANG_ENGLISH} 0 +3
MessageBox MB_OK|MB_ICONEXCLAMATION 'The installer is already running!'
goto +2
MessageBox MB_OK|MB_ICONEXCLAMATION 'El instalador ya se esta ejecutando!'

Abort


thanks RW

And how if i need 3 languages selection?
Like this??

StrCmp $R0 0 +6
StrCmp $LANGUAGE ${LANG_ENGLISH} 0 +3
MessageBox MB_OK|MB_ICONEXCLAMATION 'The installer is already running!'
goto +4
StrCmp $LANGUAGE ${LANG_SPANISH} 0 +3
MessageBox MB_OK|MB_ICONEXCLAMATION 'El instalador ya se esta ejecutando!'
goto +2
MessageBox MB_OK|MB_ICONEXCLAMATION 'O instalador está funcionando já!'
Abort


StrCmp $R0 0 end

StrCmp $LANGUAGE ${LANG_ENGLISH} 0 spanish
MessageBox MB_OK|MB_ICONEXCLAMATION 'The installer is already running!'
goto exit

spanish:
StrCmp $LANGUAGE ${LANG_SPANISH} 0 porto
MessageBox MB_OK|MB_ICONEXCLAMATION 'El instalador ya se esta ejecutando!'
goto exit

porto:
MessageBox MB_OK|MB_ICONEXCLAMATION 'O instalador está funcionando já!'

exit:
Abort

end:

I'm afraid you have a small prob with relative jumps, better use labels:-) Anyway why don't you simply add the code that you first made in .onGuiInit function?

Because I dont Know How
When I put the code in .onGuiInit , compiler show an error


because you're using MUI so you need to define your custom function MUI_CUSTOMFUNCTION_GUIINIT
See the MUI manual http://nsis.sourceforge.net/Docs/Mod...UI/Readme.html
General Custom Functions


OK RW
Thanks again


You're welcome!
Note that I made the above code with the specific structure to help you understand the difference between relative jumps and labels :-)
Actually this is enough:

StrCmp $R0 0 end

StrCmp $LANGUAGE ${LANG_ENGLISH} 0 +3
MessageBox MB_OK|MB_ICONEXCLAMATION 'The installer is already running!'
Abort

StrCmp $LANGUAGE ${LANG_SPANISH} 0 +3
MessageBox MB_OK|MB_ICONEXCLAMATION 'El instalador ya se esta ejecutando!'
Abort

MessageBox MB_OK|MB_ICONEXCLAMATION 'O instalador está funcionando já!'
Abort

end:

Thanks for the explantion and thanks again for your time
Bye