Archive: Changing $LANGUAGE in .onInit


Changing $LANGUAGE in .onInit
I have a single installer which, supports multiple languages. This enables us to give the user a single download, which uses the matching language which the website also uses.

The problem I am having is that given the following code:


LangString HELLOWORLD ${LANG_ENGLISH} "English"
LangString HELLOWORLD ${LANG_GERMAN} "German"

Function .OnInit
StrCpy $LANGUAGE "${LANG_GERMAN}"
MessageBox MB_OK "$(HELLOWORLD)"
FunctionEnd


The MessageBox would display "English" and not "German", in the .OnInit function, however once in an installer Section, a MessageBox would then show correctly "German".

Checking the values in $LANGUAGE it is correctly set to German in the .OnInit function.

It is very odd, any ideas about this? Is the .OnInit function supposed to work like this?

In function .onInit, language isn't yet initialized.


Does $LANGUAGE have to changed in .oninit in order to take effect? My installer is calling the language DLL from a custom page but afterwards the installer's text remains in English (my local language). I am not using MUI.


You have to change it after .onInit. You can do it in .onGUIInit (MUI, !define MUI_CUSTOMFUNCTION_GUIINIT myOnGuiInit).

Stu