Skip to content
⌘ NSIS Forum Archive

Changing $LANGUAGE in .onInit

4 posts

99999999#

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?
kfank#
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.
Afrow UK#
You have to change it after .onInit. You can do it in .onGUIInit (MUI, !define MUI_CUSTOMFUNCTION_GUIINIT myOnGuiInit).

Stu