- NSIS Discussion
- Customize language selection dialog
Archive: Customize language selection dialog
jdt2oo7
7th May 2010 01:14 UTC
Customize language selection dialog
Hello all,
1. Is there a way to use the bitmap image of the installation wizard in the language selection dialog also?
2. For #1 to work, we'll need increase the size of the language selection dialog, can we do that?
Only things that we can customized from reading the readme file are:
- The window title of the language selection dialog.
- The text to display on the language selection dialog.
Thanks!
Afrow UK
7th May 2010 09:28 UTC
You need to modify the LangDLL plug-in.
Stu
CrushBug
10th May 2010 22:36 UTC
Or write your own, which is what we are having to do.
Animaether
11th May 2010 01:21 UTC
You could also create your own dialog using existing constructs. I think this (from Afrow UK) is one of the more sensible solutions:
Originally posted by Afrow UK
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.
http://forums.winamp.com/showthread.php?t=318551
CrushBug
11th May 2010 17:34 UTC
While that is true, you would not be able to get a full, localized multi-code page selection. I don't think it would be much better than the existing one.
Animaether
11th May 2010 18:02 UTC
Originally posted by CrushBug
you would not be able to get a full, localized multi-code page selection.
Perhaps I missed something, but as far as I know, the only thing the LangDLL plugin does is to take the stack of UI text data, language IDs and strings, build a small UI from that with the UI text data and a dropdown, and return the chosen language when done.
All of the actual language handling itself is unrelated to that part - and that part can certainly be set up using e.g. nsDialogs.. at which point you can add a bitmap or any other control.
bnicer
12th May 2010 18:19 UTC
Quoting the manual:
4.10.1 Language Selection
When the installer starts up it goes through these steps to select the interface language:
1. Get user's default Windows UI language
2. Find a perfect match for the language
3. If there is no perfect match, find a primary language match
4. If there is no match, use the first language defined in the script (make sure your first language is a common one like English)
5. If the language variable $LANGUAGE has changed during .onInit, NSIS goes through steps 2 to 4 again.
In my experience:
1. The codepage is determined by the system language
2. You include language files
!insertmacro MUI_LANGUAGE "Italian" ; default
!insertmacro MUI_LANGUAGE "English"
The codepage is redefined to Italian on an Italian OS, English on an English OS, and Italian on a German OS. Italian, appearing first, is the default.
3a. Insert the LangDLL macro in .onInit
!insertmacro MUI_LANGDLL_DISPLAY
The language dialog will display.
3b. Alternatively ...
;Language selection dialog
Push ""
Push ${LANG_Italian}
Push Italian
Push ${LANG_ENGLISH}
Push English
Push A
LangDLL::LangDialog "$(MESSAGE_INST_LANG_TITLE)" "$(MESSAGE_INST_LANG_INFO)"
Pop $LANGUAGE
StrCmp $LANGUAGE "cancel" 0 +2
Abort
The language dialog will also display.
4. You only want to display the language dialog if neither English, nor Italian are the Windows language.
${If} $LANGUAGE != 1033 ; English
${AndIf} $LANGUAGE != 1040 ; Italian
!insertmacro MUI_LANGDLL_DISPLAY
${EndIf}
Will this display the language dialog on a German OS, but not on an Italian or English OS?
It shouldn't. Remember, the installer's codepage was set to 1040, Italian.
The installation obviously can't be in German because the German language file was never inserted.
Is there a known method of displaying the language dialog on the German OS to let the user choose between installing in Italian or English, and skipping the language dialog, if the Windows UI language is Italian or English? In short, to get the system codepage 1031 (for German) before the installer redefines the codepage based on the included languages in the script?
---------
Note, I'm about to go trawling (on the forum/in the documentation) for an environment variable or system call that returns the user's system language. It would be much better, if the installer retained the original codepage, instead of redefining it.
---------
CrushBug
12th May 2010 18:53 UTC
Originally posted by Animaether
Perhaps I missed something, but as far as I know, the only thing the LangDLL plugin does is to take the stack of UI text data, language IDs and strings, build a small UI from that with the UI text data and a dropdown, and return the chosen language when done.
All of the actual language handling itself is unrelated to that part - and that part can certainly be set up using e.g. nsDialogs.. at which point you can add a bitmap or any other control.
The Lang DLL plugin cannot do this (should be a language select image there):
http://www.scratchpaper.com/homeWe need to support English, French, German, Italian, Spanish, Czech, Hungarian, Polish and Russian. Lang select has to take place before GUI init and language isn't set there so we cannot set the text on the Lang DLL to Russian if we are on a Russian OS and see it display properly unless you change your code page for non-Unicode. This is a PITA for testing. What we want is a language select dialog similar to how Steam does its language selection, showing both the name of the language in the current OS language as well as the name of the language in its native language. Our Loc QA constantly ding us for the lack of full loc support in language select. For that, we are going to write our own Language select plug-in.
Everything else you say is completely correct and is not a problem that we are having.
Animaether
12th May 2010 21:37 UTC
Originally posted by CrushBug
What we want is a language select dialog similar to how Steam does its language selection, showing both the name of the language in the current OS language as well as the name of the language in its native language.
Well that's what I'm saying.. you should be able to do that using nsDialogs + the unicode build of NSIS of course, created as a separate installer executable, run with execwait from .onINit, and returning the value needed to select the language in .onInit.
A plugin may be easier, of course, but I do think it can be done without :)
CrushBug
12th May 2010 21:55 UTC
Originally posted by Animaether
Well that's what I'm saying.. you should be able to do that using nsDialogs + the unicode build of NSIS of course...
We aren't allowed to use the Unicode build which is why we have to do it ourselves via a plug-in.
It is the struggle that we have where we are limited in what we can and can not do with NSIS due to corporate regulations. NSIS is 90% of what we need with the power and flexibility to cover another 5-8% through our own plug-ins and funky scripting. The rest we just tell them we cannot do or conform to the rules. There are just a few things, that if changed in NSIS, would make it perfect for us. But we love what we have and are much happier with NSIS than our past battles with InstallShield and the like.
Animaether
12th May 2010 22:32 UTC
Originally posted by CrushBug
We aren't allowed to use the Unicode build which is why we have to do it ourselves via a plug-in.
Ahhhhh... gotcha :) Yes, that would complicate matters vastly ;)
Good luck with the plugin :)
Afrow UK
12th May 2010 23:12 UTC
I would have used the existing LangDLL plug-in as a base (assuming you haven't already) or otherwise writen a new plug-in (as you are doing) or even just a standard Windows executable (a bit quicker to produce).
Stu