Archive: How can I force the language to get re-read after onInit?


How can I force the language to get re-read after onInit?
For my installer, I was using the LangDialog DLL for a while to have users choose a language, but there was an issue: it's a really small window that opens, and it would commonly get "lost" on users machines. They would try to open the exe, not see the small language picker, and end up never installing.

Instead what I did was create a droplist on the first main page that users see, which is a CustomPage I created. The custom page allows the users to select the language from a drop-down list, and in the leave function of the custom page, I copy the selection to the $LANGUAGE variable.

The problem I'm having is that even though the $LANGUAGE variable is set correctly, the strings being used in the installer aren't the language set in $LANGUAGE. From what I'm reading in these forums, it looks like NSIS will somehow set the appropriate language to show sometime after onInit exits, but before any custom pages are shown.

Is there a way to force the installer to re-init the language for the installer after onInit has finished and pages are showing? I've tried manually calling onInit again from my custom page (after the $LANGUAGE is set correctly), and that mostly worked, but that seems like a buggy solution, and in my case calling onInit twice causes some other problems.

Any ideas?

Thanks,
Ryan


The easiest solution would be to move your custom dialog to another NSIS executable and run that from .onInit. You can store the chosen language in the registry temporarily or pass it as the exit code (error level): http://nsis.sourceforge.net/Docs/AppendixD.html#D.1.

Stu


Hi

I need to do the same thing with the Welcome page

I was able to create my own Welcome nsDialog based on Welcome.nsh, but I don't even know how to populate the dropdown list with the available languages.

Does anybody have a working code for this? An example that I can base on?

I am new to NSIS but have this enormous task to do...

"rgerard", have you been able to create this? Would it be possible for you to share some of your code?

Any help is much appreciated!

Many thanks


Originally posted by htome
I was able to create my own Welcome nsDialog based on Welcome.nsh, but I don't even know how to populate the dropdown list with the available languages.
See:
http://nsis.sourceforge.net/Move_data_between_ListBoxes
and
http://forums.winamp.com/showthread.php?t=318395 (read full thread)

Populating the drop-down list
Hi htome,

I was using InstallOptions, not nsDialogs, so it might be a bit different for you. Basically, I defined the Droplist in my INI file, like so:

[Field 6]
Type=DropList
Left=230
Right=300
Top=125
Bottom=136
Flags=Notify
ListItems=English|Japanese|German|Dutch

When you render the Droplist, it should have the items already. I hope that helps!