Archive: Wrong Language used


Wrong Language used
I have the following code:

LangString AlreadyInstalled ${LANG_ENGLISH} "An installation of ${PRODUCT_NAME} ${PRODUCT_VERSION} has been found.$\nUninstall it before trying to re-install."
LangString AlreadyInstalled ${LANG_FRENCH} "${PRODUCT_NAME} ${PRODUCT_VERSION} est deja installe.$\nDesinstallez-le avant de le re-installer."

Function .onInit

MessageBox MB_OK "1. ENG ${LANG_ENGLISH} FR ${LANG_FRENCH} CUR $LANGUAGE"

!insertmacro MUI_LANGDLL_DISPLAY

MessageBox MB_OK "2. ENG ${LANG_ENGLISH} FR ${LANG_FRENCH} CUR $LANGUAGE"

; Prevent re-installing
ReadRegStr $TMP ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName"
IfErrors NotInstalled Installed
Installed:
MessageBox MB_OK "2a. ENG ${LANG_ENGLISH} FR ${LANG_FRENCH} CUR $LANGUAGE"
MessageBox MB_OK|MB_ICONSTOP "$(AlreadyInstalled)"
MessageBox MB_OK "2b. ENG ${LANG_ENGLISH} FR ${LANG_FRENCH} CUR $LANGUAGE"
Abort
NotInstalled:
FunctionEnd

The message boxes show

1. ENG 1033 FR 1036 CUR 1033
2. ENG 1033 FR 1036 CUR 1036
2a. ENG 1033 FR 1036 CUR 1036
An installation of MyProduct 1.0 has been found. Uninstall it before trying to re-install.
2b. ENG 1033 FR 1036 CUR 1036

Why do I get the English message whereas $LANGUAGE is set to French?

Thanks,

Tieum


The language you set in .onInit isn't really set until .onInit ends. Therefore the language NSIS found most fit would be used for any LangString in .onInit. You can show the message in .onGUIInit or in a custom page.
I searched the forum

-Stu

Would be nice to have this in the doc.

Thanks,


Tieum


Enjoy :)


tieum, you have a good point there. Perhaps it would be a good idea to add a feature request on the tracker at http://www.sf.net/projects/nsis

Edit: Actually, under Language Selection it does mention this (maybe not in a very obvious way though).

-Stu