Archive: LangString doesn't work in onInit event


LangString doesn't work in onInit event
I got a problem : the message $(DESC_SpadNotFound) is always shown in french even when I choose english in the language combobox.

LangString DESC_SpadNotFound ${LANG_ENGLISH} "Spad 6 has not been found on this computer!"
LangString DESC_SpadNotFound ${LANG_FRENCH} "Spad version 6 n'a pas été trouvé sur votre système !"

Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
ClearErrors
ReadRegStr $0 HKLM "Software\Microsoft\Windows\App Paths\winspad60.exe\Path\" ""
${If} ${Errors}
MessageBox MB_OK|MB_ICONINFORMATION "$(DESC_SpadNotFound)"
Abort
${Else}
StrCpy $INSTDIR "$0"
${EndIf}
FunctionEnd

Search the forum for "oninit langstring" and find:

http://forums.winamp.com/showthread....nit+langstring
http://forums.winamp.com/showthread....nit+langstring
http://forums.winamp.com/showthread....nit+langstring
http://forums.winamp.com/showthread....nit+langstring


Thank you. The language problem is corrected.

But how can I abort the setup if I'm in a custom page and not in the .onInit function anymore?


Using Quit.

Don't forget the custom page won't show in silent mode. You should add a check for that in .onInit.


Thank you very much. Finally, I replaced my LangString lines by tests. It's simpler as I only have one message string:

Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
ClearErrors
ReadRegStr $0 HKLM "Software\Microsoft\Windows\App Paths\winspad60.exe\Path\" ""
${If} ${Errors}
${If} "$LANGUAGE" == "${LANG_FRENCH}"
MessageBox MB_OK|MB_ICONINFORMATION "Spad version 6 n'a pas été trouvé sur votre système !"
${Else}
MessageBox MB_OK|MB_ICONINFORMATION "Spad 6 has not been found on this computer!"
${EndIf}
Abort
${Else}
StrCpy $INSTDIR "$0"
${EndIf}
FunctionEnd